trying to do that for an obby, I am new at GUI scripts. so how would I do that?
Please and thank you
To make the GUI pop up you would need a server script and a local script. The server script would fire a remote event when a player touches the block. Then, a local script would clone the GUI from replicated storage and parent it to the player’s PlayerGui when the event is fired.
or i can just make it visible?
Making the GUI pop up, have a script placed wherever, and make it so when the player touches the block you make the GUI visible.
Done.
EDIT:
Providing example code.
local brick = workspace.some_random_brick_here
brick.Touched:connect(function(z)
local hum = z.Parent:FindFirstChild("HumanoidRootPart")
if not hum then return nil end -- Remove some if, else statements.
hum = hum.Parent
local player = game.Players:GetPlayerFromCharacter(hum)
if not player then return nil end
player.PlayerGui.some_random_gui_here.Visible = true
end)
That should also work, but I think performance wise it may be better to clone it.
No offense, but what you just said was way off course.
First off, doing .Visible = true
does not hinder performance at all, cloning a GUI into a player’s PlayerGui would though. You can tell because if you just make it .Visible = true
then the memory does not change, as it stays the same.
But if you have a GUI in ReplicatedStorage you’d want to put into the PlayerGui, once you put it in there you’d see the memory change.
how do i make it so that it slowly appears? like 0.1 transparentcy per 0.1 second
If the player may never use the GUI then I thought keeping it in replicated storage would make more sense.
That doesn’t make any sense though.
Why would you give the client a whole copy of a GUI if you could just make the GUI visible.
What if i have mutiple guis and mutible areas(blocks)
Apply the same for them.
Though, beware.
Do not have multiple scripts doing a task for individual guis/blocks. Only have one.
That one script can handle many by multitasking(using a new thread or using current one).
hmm ok thanks for your help and everyone else’s