Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make the tool automatically unequip after 15 seconds?

In this script, if you equip the tool your WalkSpeed boost from 16 to 30, I made it so after 15 seconds of the tool being equipped your WalkSpeed automatically goes back to 16. I also made it so if you unequipped the tool yourself your WalkSpeed goes back to 16. But it wouldn't make sense for your WalkSpeed to go back to 16 after 15 seconds and have the tool still equipped in your hand. How would I make it so after 15 seconds not only does your WalkSpeed go back to 16, but your tool automatically unequips without the user unequipping it themselves?

Script:

local tool = script.Parent
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

tool.Equipped:Connect(function()
  char.Humanoid.WalkSpeed = 30
wait(15)
char.Humanoid.WalkSpeed = 16
end)

tool.Unequipped:Connect(function()
	char.Humanoid.WalkSpeed = 16
end)

========================================================================================================================================================

Any answers are appreciated!

4 comments

0

The font is too big, please edit it so it's small

0

I don't know how

0

You literally changed the font size in the same question, how do you not know how?

0

Just Remove the tool from the backpack

1 answer

✓ Accepted answer

Font size was way too big, idk how you managed to do that, but besides that, your problem is easy to solve. You just disable it, wait a tick, and then reenable it within the same thing that turns the walkspeed to 16 after 15 seconds.

local tool = script.Parent
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

tool.Equipped:Connect(function()
  char.Humanoid.WalkSpeed = 30
wait(15)
char.Humanoid.WalkSpeed = 16
char.Humanoid:UnequipTools()
end)

tool.Unequipped:Connect(function()
    char.Humanoid.WalkSpeed = 16
end)

5 comments

0

Didn't work.

0

Try it now

0

Still doesn't work.

0

I found the correct answer

0

Works, thank you.

This discussion is preserved as it was. New answers, comments, and votes are closed.