Gui requires amount of leaderstats to disappear

So I’m making a gui. But the problem is, I made the problems and locked screen, and I don’t know how to make it so the game checks if a player has a required amount of stats. In this case, the stats name is “kills”

When you have the amount of kills needed, the locked gui will disappear and allow you to click the buttons behind it. No subtracting stats value like doors.

Edit: disappear by itself or needs manual click to disappear.

Well, if you’ve already made the leaderstats & it’s in a PlayerAdded event, you could just reference the Player’s GUI, use a Changed event to detect if the player has enough “Kills”, then disable the GUI if they do

I’ll do the event locally since you’re modifying a user’s GUI, locally.

1 Like

Heya I’m just gonna show you how you can do this:

local requiredKills = 10
-- This is where you change the kills for whenever you get a kill

if(plr.leaderstats.Kills.Value  > requiredKills ) then
 -- Reference the gui here and make it visbile
end

otherwise if you don’t want to do it in the script where the kills are being updated just use the .Changed event IntValue | Roblox Creator Documentation.

3 Likes

Still you can reference it both ways

From the client side without the PlayerAdded event
Or the server side using the PlayerAdded event

It depends on the scenario, since there’s not enough information to confirm

honestly I was thinking it was going to be like:
if Kills.Value >=10 then

that looks right actually. But since my studio is broken, I can’t test anything.

Pretty much

Doing it instantly you can just use the example @Crafter215 gave, although he did forget to reference Kills.Value :thinking:

yup, good luck testing it once studio is working again tho :slight_smile:

Um. you mind sending a few images after helping me testing it :laughing:

Oh right stupid me I forgot that, will change it rn, thanks for telling me :slight_smile:

1 Like

If your willing to help me test it*

so its like this:
local requiredKills = 10
– This is where you change the kills for whenever you get a kill

if(plr.leaderstats.Kills.Value > requiredKills ) then
– Reference the gui here and make it visbile
end

Sorry but it only works with your code as I don’t have the stuff you already coded or got

And yes, that’s how you do it.

kay. Well I’m just going to mark it as solution since it looks right. the topic kind of makes me look dumb.

No it’s fine, every question is fine as long as it’s not a troll question

Okay, well. I’m on a deadline for myself on my game. Gotta finish a summer update in maximum 9 days.

Oh nice, I wish you good luck!

Thanks! I’ll just make a topic about it when I feel like releasing it. Also gotta go bye