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

I want player to lose coins when running but why dosen't it work?

Asked by 4 years ago
Edited 4 years ago

I put a script in server script service and put this following:

game.Players.PlayerAdded:Connect(function(plr)
        plr.CharacterAdded:connect(function(c)
        c:WaitForChild("Humanoid").Running:connect(function(speed)
        if speed >= 10 then
repeat 
    print("Working?")
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value -1
until
if speed < 10 then
    plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value +1
end
end
        end
end)
0
plr.Character instead of script.Parent on line 2. You can failsafe the Character by using either a repeat wait() until line or by waiting for CharacterAdded to fire. DeceptiveCaster 3761 — 4y
0
what about the humanoid.speed >= 10 then section is that gonna work? i will show you my result. mastercheeseit 77 — 4y
0
this is my new change but the line 9 it says Expected identifier when parsing expression,got 'if' mastercheeseit 77 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Your problem is on line 2 where you said that the humanoid would be inside of Server Script service.

0
okay but is the script working will it detect if the player is running then it will make the player lose coins? mastercheeseit 77 — 4y
Ad

Answer this question