in my game I have a script inside a part and when you stand on it it teleports you to a specific coordinate and I'm wondering if there is a way to make a gui/ loading screen that shows up for a few seconds when you teleport here is the script that is inside the teleport pad:
1 | script.Parent.Touched:connect( function (hit) |
2 | if hit.Parent:FindFirstChild( 'Humanoid' ) then |
3 | hit.Parent.HumanoidRootPart.CFrame = CFrame.new( 326.84 , 1.57 , 245.642 ) |
4 | end |
5 | end ) |
if someone knows how i could make either an animated loading screen or a gui that pops up for a few seconds when you touch the teleport pad that would be greatly appreciated.
I can help you. In the player there is the PlayerGui
folder which retains all the GUIs available on the player's screen. You can put a GUI in the StarterGui
folder called TeleportationGui
or something like this. Put a frame in that gui and call it TeleportationFrame
and add a text in the middle of the frame which writes on "Teleporting...", or what you want. Have you noticed the Visible
and Active
properties of the frame before? These will help you.
01 | local secondsNumber = 5 |
02 |
03 | local function GetPlayerFromCharacter(character) |
04 | local players = game.Players:GetChildren() |
05 | local player |
06 |
07 | for i = 1 , #players do |
08 | if character.Name = players [ i ] .Name then |
09 | player = players [ i ] |
10 | break |
11 | end |
12 | end |
13 |
14 | return player |
15 | end |
01 | script.Parent.Touched:connect( function (hit) |
02 | if hit.Parent:FindFirstChild( 'Humanoid' ) then |
03 | hit.Parent.HumanoidRootPart.CFrame = CFrame.new( 326.84 , 1.57 , 245.642 ) |
04 | local screengui = Instance.new( "ScreenGui" ) |
05 | screengui.Parent = game:GetService( "Players" ) [ hit.Parent.Name ] .PlayerGui |
06 | local frame = Instance.new( "Frame" ) |
07 | frame.Parent = screengui |
08 | frame.Size = UDim 2. new( 1 , 0 , 1 , 36 ) |
09 | frame.Position = UDim 2. new( 0 , 0 , 0 , - 36 ) |
10 | frame.BackgroundTransparency = 1 |
11 | --build the gui here |
12 |
13 |
14 | wait( 1 ) --set to how long you want to wait |
15 | screengui:Destroy() |
16 | end |
17 | end ) |