So i have this script that is a tool. This script is a server script.
local player = script.Parent.Parent.Parent
local char = player.Character
local knife = script.Rock
local holdan = script.Hold
local idle = script.Idle
local hit = script.Hit
wait(1)
local hold = char.Humanoid:LoadAnimation(holdan)
local idlepla = char.Humanoid:LoadAnimation(idle)
local hit = char.Humanoid:LoadAnimation(hit)
local hitting = false
script.Parent.Equipped:Connect(function(mouse)
mouse.Button1Down:connect(function()
print(mouse.Parent.Name)
print("yes")
if hitting == false then
hitting = true
idlepla:Stop()
hit:Play()
wait(1)
idlepla:Play()
hitting = false
end
end)
char.Humanoid:AddAccessory(knife:Clone())
hold:Play()
wait(0.46)
idlepla.Looped = true
idlepla:Play()
end)
script.Parent.Unequipped:Connect(function()
idlepla:Stop()
char.Rock:Destroy()
end)
That is the whole code which is supposed to play animations
script.Parent.Equipped:Connect(function(mouse)
mouse.Button1Down:connect(function()
print(mouse.Parent.Name)
print("yes")
if hitting == false then
hitting = true
idlepla:Stop()
hit:Play()
wait(1)
idlepla:Play()
hitting = false
end
end)
this part is not working as the "mouse.Button1Down:connect(function()" part is not detecting the click. Please help me.

1 comment
What is this script parented to?