I’m creating a script that checks if a player is holding a tool, I sadly don’t know where to start. Here is what I have so far.
local animation = 000
local Tool = player.Backpack:FindFirstChild("ToolName")
game.Players.PlayerAdded:Connect(function(p)
while true do ---See if they are holding the part.
end
end)
Please note they spawn with the tool, so I just want to detect if they are holding it. If you know how please let me know. Thanks.
Thanks, I’m now having a different problem. The tool completely stops working when you reset. It will no longer give you speed. It’s a local script inside a tool. Here is the script I used:
local p = game:GetService("Players").LocalPlayer
local char = p.Character or p.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local defaultSpeed = hum.WalkSpeed
local customSpeed = 100 --How fast you want to go.
local Tool = script.Parent
Tool.Equipped:Connect(function()
hum.WalkSpeed = customSpeed
end)
Tool.Unequipped:Connect(function()
hum.WalkSpeed = defaultSpeed
end)
local p = game:GetService("Players").LocalPlayer
repeat wait() until p.Character
local char = p.Character
local hum = char:WaitForChild("Humanoid")
local defaultSpeed = hum.WalkSpeed
local customSpeed = 100
local Tool = script.Parent
Tool.Equipped:Connect(function()
hum.WalkSpeed = customSpeed
end)
Tool.Unequipped:Connect(function()
hum.WalkSpeed = defaultSpeed
end)
I just used another method of getting the character.