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

The Script Doesn't increase the script of the Player, API Services are On, No errors?

Hello, Community.

I want to make an object that speeds you, I scripted this script for the object [ServerSided Script]:

local tool = script.Parent
local character = game:GetService("Players").LocalPlayer.Character
local backpack = game:GetService("Players").LocalPlayer.Backpack

tool.Equipped:Connect(function()
	if character.Humanoid.WalkSpeed == 16 then
		character.Humanoid.WalkSpeed = 32
	end
end)

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

It doesn't prints out an error, It's not even working!

Trying to help me will make me appreciated!

1 comment

1

Serversided scripts can't access the LocalPlayer variable that is something only localscripts can do. Try the same script as a localscript in the tool.

1 answer

✓ Accepted answer

Here's a basic script of what you're looking for

local tool = script.Parent
local char
local hum
local speed = 32 -- if you feel like changing the speed, this is the variable to do it

tool.Equipped:Connect(function()
	char = tool.Parent
	hum = char:WaitForChild('Humanoid')
	hum.WalkSpeed = speed
end)

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

Enjoy

1 comment

0

Thank you Sir! I am very appreciated of your help, Here, Get your accept. Have a nice day

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