How do I go about making a way that when a player joins it teleports them to a specific brick?
Thanks for the help in advance!
How do I go about making a way that when a player joins it teleports them to a specific brick?
Thanks for the help in advance!
function LoadPlayerFunction(Player)
Player.CharacterAdded:Connect(TeleportPlayerFunction)
end
game.Players.PlayerAdded:Connect(LoadPlayerFunction)
–You will need to write the teleportplayerfunction
game.Players.PlayerAdded:Connect(function(player)
char = player.Character or player.CharacterAdded:Wait()
char.HumanoidRootPart.CFrame = workspace.NAMEOFPART.CFrame
end)
A basic solution is to use the vanilla spawn.
Go from model > spawn
Then move the brick wherever you’d like.
That will only teleport the player once. If they die/reset they will go to the defuelt spawn location
Yep, exactly what he asked for.
I’m trying to make it teleport a player when they join the game. And idk how to do that
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local Brick = --[[path.to.brick]].CFrame
Players.PlayerAdded:Connect(function(PlayerAdded)
Workspace:WaitForChild(PlayerAdded.Name).HumanoidRootPart.CFrame = Brick
end)
Note this only teleports the player when he enters the game, not when he is respawned
game.Players.PlayerAdded:Connect(function(player)
locla char = player.Character or player.CharacterAdded:Wait()
char:WaitForChild("HumanoidRootPart").CFrame = workspace["NAMEOFPART"].CFrame
end)
Make sure to change the NAMEOFPART to the name of the part that you want the player to teleport to.
I had this issue in my game too, I fixed this issue by add a wait between 3 and 5 seconds.
local part = game.Workspace:WaitForChild("Part") -- change it to whatever part you want
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(3)
character:WaitForChild("HumanoidRootPart").Position = part.Position + Vector3.new(0, 4, 0)
end)
end)
Hope this helps!