Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited by User#5423 4 years ago

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)
0
edit:- codeblock please tab the code User#5423 17 — 4y
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 bostaffmanbulgaria1 89 — 4y

1 answer

Log in to vote
0
Answered by
moo1210 587 Moderation Voter
4 years ago

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).

Ad

Answer this question