Hello! I was wondering why this script wasn't working. It is in StarterGui in a local script
while true do if game.players.LocalPlayer.stats.Green.value = 1 then workspace.toto.TowerPortal.towername.BrickColor = BrickColor.new ("Sea green") end end
It's not working because you are setting a value with one equals sign. Using 2 equals signs waits for a value, so to fix you would do
UPDATED:
This is in a local script inside of the starter gui
local player = game.Players.LocalPlayer while true do for _,object in pairs(player.leaderstats:GetChildren()) do wait() if object.Value == 1 then workspace.toto.TowerPortal.towername.BrickColor = BrickColor.new("Sea green") end end end
leaderstats script (If you already have one don't write this)
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Green = Instance.new("IntValue") Green.Name = "Green" Green.Parent = leaderstats end)
This is probably really inefficient because im using some old methods but it works anyway :/
Howdy!
When writing statements, you use two equal signs. In other times, use just one. Try what I have below.
while true do if game.players.LocalPlayer.stats.Green.value == 1 then workspace.toto.TowerPortal.towername.BrickColor = BrickColor.new ("Sea green") end end
On top of the past answers, .Value and .Players need to be capitalized in "game.players.LocalPlayer.stats.Green.value"