I get an error attempt to index nil. how to fix this?
server sided script:
local player = game.Players.LocalPlayer if player.leaderstats.Value.Money > 12000 then player.leaderstats.Value.Money = player.leaderstats.Value.Money - 12000 player.PlayerGui.ScreenGui.TextLabel.Text = "Purchased!" end
Try:
player = game.Players.PlayerAdded:Connect(function(player) if player.leaderstats.Value > 12000 then player.leaderstats.Value = player.leaderstats.Value -12000 player.PlayerGui.ScreenGui.TextLabel.Text = "Purchased!" end)
LocalPlayer cannot be used on a server sided script, only local.
If I helped, please mark this answer as solved! We both will get a reward!