Hello I would like to make a skill for a game only work when the tool is equipped so I wrote the following script for example and it's not working. Any ideas on how to fix it ?
local uis = game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
script.Disabled = false
script.Parent.Equipped:connect(function()
script.Disabled = false
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print('The tool was equipped')
end
end)
end)
script.Parent.Unequipped:connect(function()
script.Disabled = true
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print('The tool was unequipped')
end
end)
end)

1 comment
Why at the beginning do you set the script's Disabled to false? Is it disabled in the first place?