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?
You can't find game.Players.LocalPlayer
in a script, this needs to be done in a localscript
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)
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)