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

How to make a teleportation loading screen?

Asked by
yayachik1 -11
6 years ago

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:

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(326.84, 1.57, 245.642) 
end
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.

2 answers

Log in to vote
0
Answered by
Vik954 48
6 years ago

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.

local secondsNumber = 5

local function GetPlayerFromCharacter(character)
    local players = game.Players:GetChildren()
    local player

    for i = 1, #players do
        if character.Name = players[i].Name then
            player = players[i]
            break
        end
    end

    return player
end

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.HumanoidRootPart.CFrame = CFrame.new(326.84, 1.57, 245.642)
        local Player = GetPlayerFromCharacter(hit.Parent)
        if Player then
            Player.PlayerGui.TeleportationGui.TeleportationFrame.Visible = true
            Player.PlayerGui.TeleportationGui.TeleportationFrame.Active = true
            wait(secondsNumber)
            Player.PlayerGui.TeleportationGui.TeleportationFrame.Visible = false
            Player.PlayerGui.TeleportationGui.TeleportationFrame.Active = false
        end        
    end
end)
0
where should i put the script? yayachik1 -11 — 6y
0
Inside the part which is supposed to teleport the character Vik954 48 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.HumanoidRootPart.CFrame = CFrame.new(326.84, 1.57, 245.642)
        local screengui = Instance.new("ScreenGui")
        screengui.Parent = game:GetService("Players")[hit.Parent.Name].PlayerGui 
        local frame = Instance.new("Frame")
        frame.Parent = screengui
        frame.Size = UDim2.new(1, 0, 1, 36)
        frame.Position = UDim2.new(0, 0, 0, -36)
        frame.BackgroundTransparency = 1
        --build the gui here


        wait(1) --set to how long you want to wait
        screengui:Destroy()
    end
end)
0
Only code? No explanation? WideSteal321 773 — 6y
0
ye? yayachik1 -11 — 6y

Answer this question