Speed Coil Script

How do I add a speed coil to my game?

2 Likes

if you can script a coil then make it or if u cant then use free model also its not an actually proper question right here.

I don’t know how to script. I tried looking for a free model and none of them work.

1 Like

You Could Make A Script Saying
When the Speed Coil Tool is Equipped It changes the Player Humanoid walkspeed To A Higher Number

And When the Player Unequips the Coil tool It changes the Player Speed to Normal Which is 16 By Default.

I Don’t know If this Would Entirely Work but You could Give it a Try.
Such As,

script.Parent.Equipped:connect(function()
 if hum then
  hum.WalkSpeed = 32 -- This Will Double His Speed
 end
end)

script.Parent.Unequipped:connect(function()
 if hum then
 hum.WalkSpeed = 16 -- Back to Normal
 end
end)
1 Like

he dont know how to script thing etc so he wont understand of what you are saying

You Can Get the Speed Coil Model and Remove the Scripts inside of It as they Dont Work.
Just Place it in StarterPack so that When the Player Joins, He Receives the Coil in His Inventory.

Now Place a Local Script in StarterPlayer → Starter Character Scripts.

local player = game.Players.LocalPlayer -- Gets the Player
local chara = player .Character -- Gets the Players Character
local hum = chara:FindFirstChild("Humanoid") -- Gets the Humanoid

player.Backpack.SpeedCoil.Equipped:Connect(function() -- SpeedCoil Is the Name of the Coil
 if hum then -- Checks if its the Humanoid
  hum.WalkSpeed = 32 -- Doubles the Speed of the Player
 end
end)

player.Backpack.SpeedCoil.Unequipped:Connect(function() -- SpeedCoil is Again the Name of the Coil
 if hum then -- Checks if its the Humanoid
 hum.WalkSpeed = 16 -- The Normal Speed of The Player
 end
end)
2 Likes

To explain it as good as possible and for you to understand:

  1. You need to set up a connection that listens for when the tool is equipped (Tool.Equipped).
  2. Once you have that, check if the player’s humanoid exist, you’ll need to access it as you need to change the WalkSpeed property within it.
  3. This should be a localscript, there is no reason to have this as a serverscript as the server doesn’t need to know that the speed has changed. What I mean by this is: The client’s WalkSpeed property is not replicated to the server, only the position is.

Now, for the scripting part, you need to define a few variables.

local Players = game:GetService('Players') -- Gets the player service.
local Player = Players.LocalPlayer -- Gets the player (LocalPlayer is client-sided).

local Character = Player.Character or Player.CharacterAdded:Wait()
-- This is called an inline expression, commonly used if you don't know if something exist yet, hence we're checking that, if not: wait for it to be added.
-- Before accessing the Humanoid object, we need to access the player's character as the Humanoid is located within it.

--[[
The last thing we need within the player is the Humanoid object.
WaitForChild is extremely important when working on code ran by the client (in a LocalScript).
Roblox does not guarantee the time or order in which objects are replicated from the server to the client.
This can cause scripts to break when indexing objects that do not exist yet.
--]]
local Humanoid = Character:WaitForChild('Humanoid')

local Tool = Tool_Location -- This would be your tool's location (where it exists in the game).

-- Now, let's set up a connection that listens for when the tool is equipped.
Tool.Equipped:Connect(function()
   -- Code.
end)

In case you would like to change their speed back if they unequip the tool, you can do the same, however, with Tool.Unequipped.

Tool.Unequipped:Connect(function()
   -- Code.
end)

Hopefully this lets you understand a bit more about how the Roblox API works.
Useful links: