Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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!

0
The font is too big, please edit it so it's small User#24403 69 — 5y
0
I don't know how Incinerxte 2 — 5y
0
You literally changed the font size in the same question, how do you not know how? SteamG00B 1633 — 5y
0
Just Remove the tool from the backpack Synth_o 136 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago

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)
0
Didn't work. Incinerxte 2 — 5y
0
Try it now SteamG00B 1633 — 5y
0
Still doesn't work. Incinerxte 2 — 5y
0
I found the correct answer SteamG00B 1633 — 5y
0
Works, thank you. Incinerxte 2 — 5y
Ad

Answer this question