Hello,
I am recently getting back into scripting and decided to make a physics gun using an open sourced physics system, but that is not what I am here for. I am having an issue with my tool. For some reason, the function “Tool.Activated” works fine on the first equip. However, once you unequip and re-equip, the entire function just breaks. It doesn’t print “Active”, or anything like that. Here is the script:
local tool = script.Parent
local plr = game:GetService('Players').LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild('Humanoid')
local anims = {
["Idle"] = humanoid:LoadAnimation(script:WaitForChild('Idle')),
["Use"] = humanoid:LoadAnimation(script:WaitForChild('Use'))
}
tool.Unequipped:Connect(function()
plr.PlayerScripts:FindFirstChild('Dragger').Enabled = false
anims.Idle:Stop()
end)
tool.Equipped:Connect(function()
anims.Idle:Play()
end)
tool.Activated:Connect(function() -- function breaks after unequip, does not print active or anything
print('active')
plr.PlayerScripts:FindFirstChild('Dragger').Enabled = true
anims.Use:Play()
print(plr.PlayerScripts:FindFirstChild('Dragger').Enabled)
end)
Any help would be appreciated.