Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Prevent ppl from coming to stage 21 script help (?)

Asked by 5 years ago
Edited 5 years ago

This is a localscript inside the gui's frame

I'm currently using a script to make it so if ur on 19 and u go on the stage 20 part the frame for the skip stage buy button disappears but u need to reset for that to happend which people most likely wont since its the end, is there a way to make it so when they step on it, the frame disappears like instantly? what i mean is that u don't need to reset for it to disappear, and that it just disappears as soon as you touch the part.

Here's the script:

01local plr = game.Players.LocalPlayer
02local stats = plr:WaitForChild("leaderstats")
03local value = tonumber(stats.Stage.Value)
04 
05if value == 20 then
06      script.Parent.Visible = false
07end
08 
09if value >= 0 and value <= 19 then
10      script.Parent.Visible = true
11end

Any help would be appreciated!

Have a good day! :)

2 answers

Log in to vote
0
Answered by
Fad99 286 Moderation Voter
5 years ago
01local plr = game.Players.LocalPlayer
02local stats = plr:WaitForChild("leaderstats")
03local value = tonumber(stats.Stage.Value)
04 
05if value == 20 then
06      script.Parent.Visible = false
07end
08 
09if value >= 0 and value <= 19 then
10      script.Parent.Visible = true
11end
12 
13stats.Stage.Changed:Connect(function(c)
14    if c == "Value" then
15        if value == 20 then
16            script.Parent.Visible = false
17        end
18    end
19end)

I added a . Changed event so when the value changes it will check if its 20 now, and if it is it will make the gui not show. I didint check the script in studio but it should work.

0
this changed nothing in my script, i want it to be instant like when u step on it, it disappears not that u need to reset for it to change. :( popu2004 42 — 5y
0
hmm Fad99 286 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Well, I am not a very experienced scripter, but if you are making it to where whenever you touch the brick you want, the buy button goes away, you need to put this script inside of the BRICK.

And you need to make a variable for the part you want to be stepped on, and the GUI

01local plr = game.Players.LocalPlayer
02local stats plr:WaitForChild("leaderstats")
03local value = tonumber(stats.Stage.Value)
04-- local steppedPart = — Whatever your part is
05--local gui = Wherever your GUI is
06 
07 
08steppedPart.Touched:connect(function()
09if value == 20 then
10     --Wherever your GUI is stored.Visible = false
11end
12 
13if value >= 0 and value <= 19 then
14      --Wherever your GUI is stored.Visible = true
15end
16end)

If I am not wrong, the script above should work.

0
doesn't work.. popu2004 42 — 5y

Answer this question