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

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

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

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.

2 comments

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. :(

0

hmm

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.

1 comment

0

doesn't work..

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