I can't seem to script a brick that, when touched, opens a GUI. Can someone answer a script that does that? Thanks!
COMMUNITY QUESTION
Touching Brick Opening A GUI Script?
2 answers
game.StarterGui(I assume it's here).(NameOfGUI).Visible = true
function DemNips()
game.StarterGui(I assume it's here).(NameOfGUI).Visible = true
end
script.Parent.Touched:connect(DemNips()
function DemNipsMarkII()
if game.StarterGui(I assume it's here).(NameOfGUI).Visible == true then
game.StarterGui(I assume it's here).(NameOfGUI).Visible = false
end
script.Parent.TouchEnd:connect(DemNipsMarkII()
Should work. Enjoy my creative naming. Generally though, don't ask an entire script to be written for you
local Gui = game.ServerStorage.TheScreenGui-- Replace this with location of the GUI
local Trigger = script.Parent -- Replace this with location of the part that opens the GUI
local Debounce = false --See http://wiki.roblox.com/index.php?title=Debounce
local function Touched(Part)
if Debounce then return end
local Player = game.Players:GetPlayerFromCharacter(Part.Parent) --Gets the player from the character model
if Player then --If it exists
Debounce = true
Gui:Clone().Parent = Player.PlayerGui --Clone the GUI into PlayerGui, where active GUIs are held
wait()
Debounce = false
end
end
Trigger.Touched:connect(Touched)
Note that this may not fit your use case exactly. It gives them a GUI even if they already have it; this may or may not be what you want. I'll leave that as homework though. Excuse any typos I may have made.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks @Wolf