Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I have a problem with my Tool/Sword but the Damage Script doesn't seem to worK?

Asked by
Nozyfo 2
4 years ago
Edited 4 years ago

i am making a MMORPG game but the swords doesnt seem to work here's the Local Script

local animations = {"5283426957","5283485401","5283529976"}
local CanAttack = true

script.Parent.Activated:Connect(function()
if CanAttack == true then
local animation = Instance.new("Animation",  script.Parent.Parent)
animation.AnimationId = "http://www.roblox.com/asset?id="..animations[math.random(1, #animations)]
local chosenanim = script.Parent.Parent.Humanoid:LoadAnimation(animation)
chosenanim:Play()
CanAttack = false
wait(1.5)
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)

and here's the normal script

script.Parent.Blade.Touched:Connect(function(p)

    if script.Parent.CanDamage.Value == true then

        script.Parent.CanDamage.Value = false

        p.Parent.Humanoid:TakeDamage(25)

    end

end)

i have a boolvalue in the tool that is turned off

1 answer

Log in to vote
0
Answered by 4 years ago

Filtering Enables makes it so anything changed client side won’t affect anything server side. Instead, use a remote event and make sure to check p.Parent:FindFirstChild(“Humanoid”)

0
how? Nozyfo 2 — 4y
0
i already put p.Parent:FindFirstChild("Humanoid") what should i do next? Nozyfo 2 — 4y
Ad

Answer this question