Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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”)

2 comments

0

how?

0

i already put p.Parent:FindFirstChild("Humanoid") what should i do next?

This discussion is preserved as it was. New answers, comments, and votes are closed.