Got an error trying to disable a script once player leaderstat value is = 10

error is 14:04:29.454 Workspace.Script:3: attempt to index nil with ‘leaderstats’ - Server - Script:3

local Player = game.Players.LocalPlayer

if Player.leaderstats.Grow.value == Player.leaderstats.Grow.Value == 10 then
	game.Workspace.Script.Disabled = true
	game.Workspace.leaderstats.Disabled = true
	game.StarterGui.GrowScreenGui.TextButton.LocalScript.Disabled = true
end

Is that a server script (regular script in serverscriptservice)? Nevermind, I found out its a regular script in workspace based off your error. You need to create a LocalScript and place it in StarterPlayerScripts. The code below should work.

local player = game.Players.LocalPlayer;

while true do
wait()
if player:FindFirstChild("leaderstats").Grow.Value == 10 then
workspace.Script.Disabled = true
workspace.leaderstats.Disabled = true
player:FindFirstChild("PlayerGui").GrowScreenGui.TextButton.LocalScript.Disabled = true
end
end

Regular script in workspace.
not in “ServerScript” or “ServerStorage”.

I’ve edited the message I posted, has the script which should work.

Its Not disabled for some reason it doesnt give me a error also its still going a pass the value 10 in leaderstats

I also tried to change the “;” game.players.LocalPlayer; But still is disables and going a past 10.

Maybe this will work…?

local player = game.Players.LocalPlayer;

while true do
wait()
if player:FindFirstChild("leaderstats").Grow.Value == 10 then
workspace.leaderstats.Disabled = true
player:FindFirstChild("PlayerGui").GrowScreenGui.TextButton.LocalScript.Disabled = true
script.Disabled = true
end
end

You must remove the Script in workspace, it serves no purpose as that script I posted above which should be put into a LocalScript inside of StarterPlayerScripts.

Okay let me do that right now?. and the if the script works completly

error is 14:26:06.455 Workspace.Script:3: attempt to index nil with ‘leaderstats’ - Server - Script:3

Regular scripts don’t know what LocalPlayer is. This has to be done on the client, not the server. Creat a LocalScript and put that localscript into StarterPlayerScripts. Then, copy that code I typed above and paste it into that script. Sorry to say, but if you’re not going to listen, I just won’t help.

I did that i promise i did exactly what you said i can screen share it on discord if have.