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

Script not detecting leaderstat value?

Asked by
zomspi 541 Moderation Voter
5 years ago

My script isn't detecting a leaderstat value? Here is the script:

Sever Script

local purchases = game.Players.LocalPlayer.leaderstats.Purchases.Value

game.Players.PlayerAdded:connect(function(Player)
    if Player.leaderstats.Purchases == 1 then
        game.StarterGui.ScreenGui.Frame1.Desert.Visible = true
    else
        game.StarterGui.ScreenGui.Frame1.Desert.Visible = false
end
end)


Does anyone know how to fix this?

3 answers

Log in to vote
0
Answered by
Vxpper 101
5 years ago

You can't find game.Players.LocalPlayer in a script, this needs to be done in a localscript

0
oh right, I guess I must not have seen that lol zomspi 541 — 5y
0
It still didn't work: zomspi 541 — 5y
Ad
Log in to vote
0
Answered by
zomspi 541 Moderation Voter
5 years ago

it didn't work

game.Players.PlayerAdded:connect(function(Player) if Player.leaderstats.Purchases.Value == 1 then game.StarterGui.ScreenGui.Frame1.Desert.Visible = true else game.StarterGui.ScreenGui.Frame1.Desert.Visible = false end end)

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
5 years ago

Here dude, try this:

game.Players.PlayerAdded:connect(function(Player)
    if Player.leaderstats.Purchases.Value == 1 then
        game.Players[Player].PlayerGui.ScreenGui"Frame1".Desert.Visible = true
    else
        game.Players[Player].PlayerGui.ScreenGui"Frame1".Desert.Visible = false
end
end)
0
do I do this local script or server script? zomspi 541 — 5y
0
that doesn't work either, this is what it looks like: https://ibb.co/0MmHShY and this is what it should look like: https://ibb.co/NYRpngM Thanks anyways! zomspi 541 — 5y

Answer this question