I am making an indiana jones adventure puzzle but want to make a custom teleport screen. When I run the script their is no error and it teleports fine but some some reason their is no loading screen. I don't know what to do. I looked on the wikia and everything looks right.
local openGUI = game:GetService("ReplicatedStorage").RemoteEvents.OpenGUI
local frame = script.Parent
local exit = frame.ExitButton
local clickeffect = frame.Parent.Parent:WaitForChild("ClickEffect")
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local buttons = frame.Missions:GetChildren()
local loadingFrame = frame.Parent.InGameLoading
local collectionService = game:GetService("CollectionService")
local tpService = game:GetService("TeleportService")
local tpFrame = game:GetService("StarterGui").TeleportGUI
local debounce = false
tpService.CustomizedTeleportUI = true
local UserInputService = game:GetService('UserInputService')
local StarterGui = script.Parent.Parent.Parent
local loadingScreen = Instance.new('ScreenGui', player.PlayerGui)
local loadingScreenFrame = Instance.new('Frame', loadingScreen)
loadingScreenFrame.Name = 'loadingScreenFrame'
loadingScreenFrame.BackgroundColor3 = Color3.new(0,0,0)
loadingScreenFrame.Size = UDim2.new(1,0,1,50)
loadingScreenFrame.Position = UDim2.new(0,0,0,-50)
loadingScreenFrame.Visible = false
tpService.CustomizedTeleportUI = true
for _,v in pairs(buttons)do
wait()
collectionService:AddTag(v,"ButtonTag")
end
openGUI.OnClientEvent:Connect(function()
frame:TweenPosition(UDim2.new(0.053,0,0.048,0))
clickeffect.TimePosition = .5
clickeffect:Play()
blur = Instance.new("BlurEffect",camera)
blur.Name = "TitleBlur"
blur.Size = 0
player.Character:WaitForChild("Humanoid").WalkSpeed = 0
player.Character:WaitForChild("Humanoid").JumpPower = 0
for i = 0,13,1 do
blur.Size = blur.Size + 1
wait()
end
end)
exit.MouseButton1Click:Connect(function()
clickeffect:Play()
frame:TweenPosition(UDim2.new(-1,0,0.048))
clickeffect.TimePosition = .5
camera.TitleBlur:Destroy()
player.Character:WaitForChild("Humanoid").WalkSpeed = 16
player.Character:WaitForChild("Humanoid").JumpPower = 30
for i = 0,13,1 do
blur.Size = blur.Size - 1
wait()
end
end)
function teleportPlayer(placeID, player)
tpService:Teleport(placeID, player, nil, loadingScreen)
if(tpService.TeleportInitFailed == 2)then
loadingFrame:TweenPosition(UDim2.new(-1.2,0,0.048,0))
for i = 0,10 do
wait()
tpFrame.Background.BackgroundTransparency = tpFrame.Background.BackgroundTransparency + .1
tpFrame.Background.Loading.TextTransparency = tpFrame.Background.Loading.TextTransparency +.1
i = i + 1
end
tpFrame.Parent.TeleportFailBase.Visible = true
wait(3)
tpFrame.Parent.TeleportFailBase.Visible = true
end
end
for _,v in pairs(collectionService:GetTagged("ButtonTag"))do
wait()
v.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
frame:TweenPosition(UDim2.new(-1,0,0.048))
wait(1)
loadingFrame:TweenPosition(UDim2.new(0.053,0,0.048,0))
wait(3)
teleportPlayer(v.PlaceID.Value,player)
debounce = false
end
end)
end

2 comments
Watch xxlyods youtube video
thats not what I want