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

Script works on studio but not through roblox?

Asked by
Cuvette 246 Moderation Voter
9 years ago

The is part of my script below and it works fine on studio and changes the value of Gameplay to 1 on the leaderboard but as soon as i go to use it through playing my game on the roblox website it counts down to 20 and will not go past that... Pretty much just pauses the script. I have no idea what I've done.

_G.countdowngo="Game starting in 0:20"
wait(1)
local stats = game.Players.LocalPlayer:findFirstChild("leaderstats")
            if (stats~=nil) then
                local score = stats:findFirstChild("Gameplay")
                if (score~=nil) then
                        score.Value = score.Value + 1
                end
        end
        wait(1)
_G.countdowngo="Game starting in 0:19"
wait(1)
0
Im pretty sure that anything dealing with "local", cannot communicate with "game" BSIncorporated 640 — 9y

1 answer

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
9 years ago

Global functions cannot be called from Local Scripts. Use RemoteEvents/RemoteFunctions for this.

RemoteFunction and RemoteEvent Tutorial

Ad

Answer this question