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

Guys how do you make a GUI appear when you touch it then disappear when the object is gone?

I try 2 times trying to script it but I couldn't then I tried searching it up I found nothing so this is why I need your help...

1 comment

0

Please post the code you've attempted to write. Scripting Helpers is not a requests site, and we cannot help you learn Lua if we simply provide you with working code.

2 answers

Make a GUI and put it in server storage. Name it GUI. Now, put this into a script in the brick.

script.Parent.Touched:connect(function(hit)
game.ServerStorage.GUI:Clone().Parent = hit.Parent:GetPlayerFromCharacter().Parent.PlayerGUI
end)

script.Parent.Touchended:connect(function(hit)
if hit.Parent:GetPlayerFromCharacter.Parent.PlayerGUI:FindFirstChild("ScreenGUI") and hit.Parent:GetPlayerFromCharacter.Parent.PlayerGUI:FindFirstChild("ScreenGUI").Name == "GUI" then
hit.Parent:GetPlayerFromCharacter.Parent.PlayerGUI:FindFirstChild("ScreenGUI"):Destroy()
end
end)

I'm not sure if I have enough ends.

This is not a request site. You could have atleast tried to give us some of your code. So all I can give you is:

-- onTouch function
-- Find if the script.Parents(hit) has a humanoid
-- Clone a gui from somewhere, Replicated Storage is recommended
-- Then either have a script in the Gui itself that is disabled after the player hits the part.
-- Or have the script remove it ifthe player is not touching the part.

1 comment

0

Sorry I'm new to this i didn't know.

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