Help with my Script

For some reason, my speed coil won’t work, when I first added to my game it worked, But now after more development, it does not work. Does anyone know why?

First of all, it may not be working because the script can’t find the player, meaning you changed the player’s parent to something else other than the workspace. Would appreciate if you showed us if there was an error or not.

Secondly, reorganize your script. The local script doesn’t have to be in the handle of the speed coil tool. Just place the local script inside the tool.

Thirdly, how good are you at scripting? Would like to know before I try and help you.

Fourthly, the category for this post should be in scripting support, not platform usage support.

maybe because you immediately tried to get the humanoid directly under player and not the character? also idk why you define another player when you already defined player on the very first line of the code

that’s not the issue. he already got the player. the issue is that he hasn’t defined the character, which is exactly why his coil is not working

You should use :WaitForChild() function to wait for the character of player, also why would you search workspace for that?
You can use player.Character property to get the character. ( also player.CharacterAdded:Wait() )

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- character could not be loaded
-- Finding something on workspace with localscript only works with :WaitForChild().
-- Do not use :FindFirstChild() on workspace in LocalScript.
-- and the method above is easier method getting the characterModel. use it

-- your script

So how should I do this? I’m not an experienced Scipter.

Change local script parent to the tool and copy paste this

local tool = script.Parent
local player = game.Players.LocalPlayer --gets player
local character = player.Character or player.CharacterAdded:Wait() -- gets player's character or waits for character if not loaded yet

tool.Equipped:Connect(function()
	character.Humanoid.WalkSpeed = 60
end)

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

If work give check to Seemoney

1 Like

Sorry, I should have explained more. But now that you’ve found your solution, I have no reason to explain further.

To confirm, does this script give the tool to everyone? Because I just want the person who bought the Gamepass (I made previously) to have it.

not sure what you mean by that, the script that Noob provided was to modify the walkspeed if the tool was equipped and unequipped.

I know But I also wanted to people to own the Gamepass to have the tool in their inventory, I’m just making sure this script only gives that tool to people who bought the Gamepass

1 Like

the script he provided has nothing to do with giving tools to people who own the gamepass, you can check if the player has the gamepass then clone the tool to them

So how should I do that To make the tool for only Gamepass buyers?

i took this from another topic, but here it is:

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassid) then
-- give them the tool
else
-- do not give them the tool
end

Where should I put this script in my game?

honestly it depends but this piece of code would be located in a serverscript

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.