Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How To Make The GUI Disappear?

How do I make a GUI disappear when a player have 10 Kos?

1 answer

Have you tried scripting this on your own? Have you had any luck? If you tried scripting it on your own and it doesn't work, does the output show any error's? Please include these in your question so people have more information to help you. Anyway's, here's a script that should work. Put it in a LocalScript in anything in StarterGui, or StarterPack.

wait(1)
local player = game.Players.LocalPlayer -- Reference to the Player
local stats = player:WaitForChild("leaderstats") -- I'm assuming this is your stats
local statname = "Kos" -- Basing it off what you said
local guiname = "ScreenGui" -- The gui you want to be destroyed, again you didn't say if it was a Frame or a whole GUI

stats:WaitForChild(statname).Changed:connect(function() -- If the value change's, it'll update, less laggy then doing loops
	if stats:FindFirstChild(statname) then -- Prevent's error's if it doesn't find the stat
		if stats:FindFirstChild(statname).Value == 10 then -- If the value of the stat is 10
			if player:WaitForChild("PlayerGui"):FindFirstChild(guiname) then -- Prevent error's searching for the gui
				player.PlayerGui:FindFirstChild(guiname):Destroy() -- Destroy the GUI
			end
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.