So I have a teleporter, and I want a GUI to appear when the humanoid touches the Teleport Brick. The Gui will say would you like to teleport YES or NO. What I’m asking is how do I make the teleport GUI appear when the humanoid touches the part. Any help is appreciated. Thank Devs
Hi there! I made this script a long time ago when I first started. I hope it’s any help to you.
script.Parent.Touched:connect(function(ob)
pleyer = game.Players:GetPlayerFromCharacter(ob.Parent)
if pleyer then -- checks if the player is actually a player not a part.
if pleyer.PlayerGui:findFirstChild("ENTERGUINAMEHERE") then -- make sure to edit "ENTERGUINAMEHERE" to the name of your GUI. CaSe SeNsItIvE
else
bob = script.ENTERGUINAMEHERE:Clone() -- make sure to edit "ENTERGUINAMEHERE" to the name of your GUI. CaSe SeNsItIvE
bob.Parent = pleyer.PlayerGui -- put it in the player's ui.
bob.first.Visible = true
end
end
end)
Insert this script into a part with which the player touches to make the UI pop-up.
Put the GUI in the script, so that the GUI is a child of the script.
Let me know if you need any help.
Here is a piece of code I wrote to help you out:
(You have to put the GUI variable as the Gui Frame. Also, put this script in the part that the player touches)
script.Parent.Touched:Connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
local player = game.Players[hit.Parent.Name]
local guiFrame = player.PlayerGui -- Put the gui-frame here
guiFrame.Visible = true -- This is the non-animated part.
guiFrame:TweenPosition(UDim2.new(guiFrame.Position.X.Scale,0,.3,0), 'Out', 'Sine', 1, true) --this is for whether you want to animate the gui or not
end
end)