so theres actully i few things i want to do but i dont want to make a bunch of different posts about it so ya
i want it so when you touch a part it will load in a map i put all the maps in folders so that will help (i dont need this just think it would help with lag)
i want to make a ui pop up and then go away after 5 seconds
i want it so when you touch the part it waits 5 seconds and then teleports you
sry if this is to much to ask for but i think its better than making 3 separate posts
Lets say you have your maps in a folder called Maps (in server storage).
Add a Script in your part, in this script you should utilize Roblox’s built in Touched event, then you should either clone the map or change the maps parent to the workspace, finally spawn a new thread, wait 5 seconds and teleport the player.
Example:
local Players = game:GetService("Players")
local SS = game:GetService("ServerStorage")
local Part = script.Parent
local Maps = SS.Maps
local debounce = {}
local function OnPartTouched(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
if debounce[player.UserId] then return end
local map = Maps.MapName:Clone()
map.Parent = game.Workspace
debounce[player.UserId] = true
task.spawn(function()
task.wait(1)
debounce[player.UserId] = nil
task.wait(4)
end)
end
When do you want this to happen, and what is the name of the UI (can you provide a screenshot of the explorer for the UI)
sry for the late reply but i want the ui to pop up and then the player gets teleported so like a loading screen ui the name of the ui doesnt matter you can just put it in the script since the ui isnt made yet but it would be an image label
Ok, so the script should look something like this:
local Players = game:GetService("Players")
local SS = game:GetService("ServerStorage")
local Part = script.Parent
local debounce = {}
local function OnPartTouched(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
if debounce[player.UserId] then return end
local map = SS.Map1.MapName:Clone()
map.Parent = game.Workspace
debounce[player.UserId] = true
local PlrGui = player.PlayerGui
local ScreenGui = PlrGui.LoadingUI
local Label = ScreenGui.ImageLabel
task.spawn(function()
Label.Visible = true
task.wait(1)
debounce[player.UserId] = nil
task.wait(4)
Label.Visible = false
local char = player.Character
char.HumanoidRootPart.Position = map.TPPart.Position
end)
end
Part.Touched:Connect(OnPartTouched)