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

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

Asked by 3 years ago

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
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. EnzoTDZ_YT 275 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

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

0
Thank you Sir! I am very appreciated of your help, Here, Get your accept. Have a nice day RektwayYTB 123 — 3y
Ad

Answer this question