So i already have a basic outline with two scripts, a local script for animation and a server script for damage. But its not working. Can anyone help?????
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local isAttacking = false
local idleAnim = humanoid:LoadAnimation(tool:WaitForChild("Idle"))
local punchAnim = humanoid:LoadAnimation(tool:WaitForChild("Punch"))
tool.Equipped:Connect(function()
idleAnim:Play()
end)
tool.Activated:Connect(function()
print("Activated!")
if isAttacking == false then
isAttacking = true
local rightArm = tool.Parent:WaitForChild("Right Arm")
punchAnim:Play()
rightArm.Touched:Connect(function(hit)
print("Collided!")
local humanoid = hit.Parent:WaitForChild("Humanoid")
if humanoid then
tool.TouchedEvent:FireServer(humanoid,hit)
end
end)
wait(2)
isAttacking = false
end
end)
tool.Unequipped:Connect(function()
idleAnim:Stop()
end)
There, that's the local script the root of my problem (probably).

3 comments
Not a good scripter but I do know if you want to make it so a Client can look like he's punching try using remote events to fire servers https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
well i am using remote event
which prints work?