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

How to make it so when you touch a brick a random gui appears and you get teleported somewhere?

I have a brick that telports you to another brick but im wondering how to make it so that when you touch it a random gui appears

heres my script inside the part that i want the player to touch and the random gui to pop up and the player to teleport to another brick

can someone tell me how to add it so that it picks a random gui to show for 3 seconds and then dissapear

function onTouch(part)
if part.Parent.Humanoid ~=nil then
part.Parent:MoveTo(script.Parent.Parent.RespawnPoint1.Position)
end
end
script.Parent.Touched:connect(onTouch)

2 comments

0

edit:- codeblock please tab the code

0

You will use that "part" and find the parent of the thing that touched it and if there's a humanoid inside of it. Then you'll FindFirstChild the Humanoid.Parent in Players. The Humanoid Parent will be the player model which is also the player name. Then clone the UI you want to put in the player and put it in the player's PlayerGui. Hope that explains what you need because I'm bad at explaining xd

1 answer

You could clone the gui and add it to there players for 3 seconds then delete it.

player = game.Players:GetPlayerFromCharacter(part.Parent)
copy = locationtogui:Clone()
copy.Parent = player.PlayerGui
wait(3)
copy:Destroy()

Put after part.Parent:MoveTo(script.Parent.Parent.RespawnPoint1.Position).

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