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

Checking if player is playing minigame?

Asked by
Cuvette 246 Moderation Voter
9 years ago

Hey, me again... I have a GUI in which players can press spectate to not play the next minigame. The problem is, this has its own script and the script below is in my minigame script.

I need to set up a boolean to check if the player is spectating or not, and if they are they won't earn points as stated below. But if I use a global variable, surely all players would be classed as spectating if one player presses the button.

Basically for this script to read my other one in the GUI I would have to use a global variable, and if I do every time one person presses the button and changes that global variable, it will change for everyone.

for i,v in pairs(game.Players:GetPlayers()) do
            isplaying = v:FindFirstChild("IsPlaying")
            if (isplaying) then
                if (isplaying.Value == true) then
                    v.leaderstats.Points.Value = v.leaderstats.Points.Value + reward
                end
            end
        end
0
Are there any errors in the output? Tkdriverx 514 — 9y
0
No I have no errors, is it possible to create a variable in each of the players? Cuvette 246 — 9y

Answer this question