local players = game.Players.LocalPlayer
local anim1 = script.Parent.Animation
local anim2 = script.Parent.FireAnimation
local animR = script.Parent.PistolReloadAnim
local anim = script.Parent.Rest
local camera = game.Workspace.CurrentCamera
local Value = script.Parent.Value
local Value2 = Value.Value
Value.Value = 6
local track
local trackR
local track2
local trackA
local UIS = game:GetService("UserInputService")
local CanFire = false
script.Parent.Equipped:Connect(function()
track = players.Character.Humanoid:LoadAnimation(anim1)
track:Play()
end)
local debouce = false
local Temp = false
UIS.InputBegan:Connect(function(key)
if players.Character:FindFirstChild("Revolver") then
if key.KeyCode == Enum.KeyCode.E then
if Temp == false then
Temp = true
print("K")
trackA = players.Character.Humanoid.Animator:LoadAnimation(anim)
trackA:Play()
elseif Temp == true then
Temp = false
trackA:Stop()
end
end
end
end)
#Other players can't hear sounds or see effects from the gun.
1 messages · Page 1 of 1 (latest)
UIS.InputBegan:Connect(function(key)
if players.Character:FindFirstChild("Revolver") then
if key.KeyCode == Enum.KeyCode.E then
if Temp == false then
Temp = true
print("K")
trackA = players.Character.Humanoid.Animator:LoadAnimation(anim)
trackA:Play()
elseif Temp == true then
Temp = false
trackA:Stop()
end
end
end
end)
UIS.InputBegan:Connect(function(key)
if players.Character:FindFirstChild("Revolver") then
if key.KeyCode == Enum.KeyCode.R then
trackR = players.Character.Humanoid:LoadAnimation(animR)
trackR:Play()
script.Parent.Part.RELOADSOUND:Play()
wait(1)
Value.Value = 6
end
end
end)
script.Parent.Activated:Connect(function()
if Value.Value > 0 then
if debouce == false then
debouce = true
Value.Value = Value.Value - 1
track2 = players.Character.Humanoid:LoadAnimation(anim2)
track2:Play()
camera.CFrame = camera.CFrame * CFrame.Angles(.005,math.rad(.5),0)
wait(.01)
camera.CFrame = camera.CFrame * CFrame.Angles(.0015,math.rad(.8),0)
wait(.01)
camera.CFrame = camera.CFrame * CFrame.Angles(.002,math.rad(.5),0)
wait(.01)
camera.CFrame = camera.CFrame * CFrame.Angles(-.0015,math.rad(0),0)
wait(.01)
camera.CFrame = camera.CFrame * CFrame.Angles(-.005,math.rad(0),0)
wait(.01)
camera.CFrame = camera.CFrame * CFrame.Angles(-.002,math.rad(0),0)
script.Parent.Part.MuzzleLight2.Enabled = true
script.Parent.Part.MuzzleFlash.Enabled = true
script.Parent.Part.Muzzle.Enabled = true
script.Parent.Part.MuzzleLight.Enabled = true
script.Parent.Part.Muzzle1.Enabled = true
script.Parent.Part.Muzzle2.Enabled = true
script.Parent.Part.FIRE:Play()
wait(.12)
script.Parent.Part.Muzzle2.Enabled = false
script.Parent.Part.Muzzle1.Enabled = false
script.Parent.Part.MuzzleLight2.Enabled = false
script.Parent.Part.MuzzleFlash.Enabled = false
script.Parent.Part.Muzzle.Enabled = false
script.Parent.Part.MuzzleLight.Enabled = false
debouce = false
if Value.Value < 0 then
Value.Value = 0
if Value.Value == 0 then
print("Out OF Amno")
end
end
end
end
end)
script.Parent.Unequipped:Connect(function()
track:Stop()
trackA:Stop()
track2:Stop()
end)
Are you playing the sound and effects all in a localscript?
Yeah
thats why
I figured out the problem but theres still a bug
I made a server side script and used a remote event
yeah
but the player can still see the effects even after the amno is gone
local Value
local debouce = false
local Value = script.Parent.Value
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player)
script.Parent.Activated:Connect(function()
if Value.Value > 0 then
if debouce == false then
debouce = true
script.Parent.Part.MuzzleLight2.Enabled = true
script.Parent.Part.MuzzleFlash.Enabled = true
script.Parent.Part.Muzzle.Enabled = true
script.Parent.Part.MuzzleLight.Enabled = true
script.Parent.Part.Muzzle1.Enabled = true
script.Parent.Part.Muzzle2.Enabled = true
script.Parent.Part.FIRE:Play()
wait(.12)
script.Parent.Part.Muzzle2.Enabled = false
script.Parent.Part.Muzzle1.Enabled = false
script.Parent.Part.MuzzleLight2.Enabled = false
script.Parent.Part.MuzzleFlash.Enabled = false
script.Parent.Part.Muzzle.Enabled = false
script.Parent.Part.MuzzleLight.Enabled = false
debouce = false
end
end
end)
end)
Sevrer side script
buddy this stuff easy
Shut up
mb
Then help 😭
i lied i dont know how to script
you know you dont have to do script.parenmt.part.muzzle.muzzlelight2.Enabled for everything
?
you can just do
** You are now Level 3! **
local Main = script.Parent
for _, v in Main:GetDescendants() do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
end
Ah
or in your case do script.Parent.Part
also why are you enabling them instead of doing Particle:Emit()
Whats the difference?
You can choose how much particles you want to emit
like PartileEmitter:Emit(5)
it emits 5 particles
you'd have to set the rate to 0 and have the particleemitter enabled
so you can do
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player)
script.Parent.Activated:Connect(function()
if Value.Value > 0 then
if debouce == false then
debouce = true
for _, v in script.Parent.Part:GetDescendants() do
if v:IsA("ParticleEmitter") then
v:Emit(5)
end
end
debouce = false
end
end
end)
end)
Now the effects aren't showing
Oh wait
yeahn
Particles still emit even after value = 0
can i see
the value is 6, so once it fires 6 times theres no more amno left
The local script works, you can see because the animation stopped playing as it should
but the effects continue even after the value is 0
are you checking if its value is 0
if the value equals zero the effects shouldn't play, so saying >= would still make it play because the value = 0
crazy how something so simple takes so long
I mean its just how it is
it sucks tho
not really thats just what makes it more motivating to finish unless it requires a whole lotta math
ye
I mean you can just do if value.value >= 1 then
The particles still emit 
Yeah but its not the best
I'd probably just use blender
takes time to learn it tho
Depends on the gun
if Value.Value < 0 then
Value.Value = 0
if Value.Value == 0 then
print("Out OF Amno")
end
end
why are you setting it to 0?
Because the value subracts with each click
if it isn't set to 0, it'll go to -1
and the whole script goes crazy when the value is set to -1
I think you did something wrong it should stop when it reaches zero
In the old script, before the remote event, it did stop
the script isn't even detecting the value or somthing
local debouce = false
script.Parent.Activated:Connect(function()
if Value.Value >= 1 then
debouce = true
Value.Value = Value.Value - 1
for _, v in script.Parent.Part:GetDescendants() do
if v:IsA("ParticleEmitter") then
v:Emit(5)
end
end
wait(.5)
debouce = false
if Value.Value == 0 then
debouce = true
wait(1)
Value.Value += -- the amount of bullets in your gun
debouce = false
end
end
end)
** You are now Level 4! **
We came to the same conclusion lol
I just figured out what was the problem
It works now, I needed to subtract the value in the server side script aswell
alr well ima get going
Thank you for the help 🔥