I want the script teleport players to a random map, the problem is i can’t find the Variable of the Character.
local GiftShop = game.Workspace.GiftShop
local SandyDesert = game.Workspace.SandyDesert
local Cinema = game.Workspace.Cinema
local PoisonousIsland = game.Workspace.PoisonousIsland
local Maps = {
GiftShop,
SandyDesert,
Cinema,
PoisonousIsland
}
local n = math.random(1,#Maps)
local selectedMap = n
print('The map is: '..selectedMap)
local Player = game.Players.LocalPlayer
local Character = Player.Character
print('teleporting')
if selectedMap == '1' then -- GiftShop
Character.HumanoidRootPart.CFrame = GiftShop.Target.CFrame
end
if selectedMap == '2' then -- SandyDesert
Character.HumanoidRootPart.CFrame = SandyDesert.Target.CFrame
end
if selectedMap == '3' then -- Cinema
Character.HumanoidRootPart.CFrame = Cinema.Target.CFrame
end
if selectedMap == '4' then
Character.HumanoidRootPart.CFrame = PoisonousIsland.Target.CFrame
end
I hope you can help me! Thanks for reading.