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:

local plr = game.Players.LocalPlayer
local stats = plr:WaitForChild("leaderstats")
local value = tonumber(stats.Stage.Value) 

if value == 20 then
      script.Parent.Visible = false
end 

if value >= 0 and value <= 19 then
      script.Parent.Visible = true 
end

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
local plr = game.Players.LocalPlayer
local stats = plr:WaitForChild("leaderstats")
local value = tonumber(stats.Stage.Value) 

if value == 20 then
      script.Parent.Visible = false
end 

if value >= 0 and value <= 19 then
      script.Parent.Visible = true 
end

stats.Stage.Changed:Connect(function(c)
    if c == "Value" then
        if value == 20 then
            script.Parent.Visible = false
        end
    end
end)

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

local plr = game.Players.LocalPlayer
local stats plr:WaitForChild("leaderstats")
local value = tonumber(stats.Stage.Value) 
-- local steppedPart = — Whatever your part is
--local gui = Wherever your GUI is


steppedPart.Touched:connect(function()
if value == 20 then
     --Wherever your GUI is stored.Visible = false
end 

if value >= 0 and value <= 19 then
      --Wherever your GUI is stored.Visible = true 
end
end)

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

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

Answer this question