I have been trying to fix a problem that I have encountered but i just cant.
My problem is that i try to teleport the HumanoidRootPart of my player from the SpawnPoint that it Spawned to a parts CFrame but it just doesnt do anything.
I tried out of couriosity to add a loop to keep teleporting, when the player walked it could walk a little but then got teleported back to the SpawnPoint forever.
I also accidently pressed “Play Here” instead of “Play” and for some reason it worked and the player got teleported to the part i Wanted it to go.
Basicly for more Context, when the players Character gets added and loads, a local script sents a Remote Event to a Server Script and there it makes the player teleport to where i want it to.
I apologise if you are confused but I whould appreciate your Support
If you want to teleport a player whenever you like, you can do this:
local _CFrame = {
position = Vector3.new(0,0,0),
orientation = Vector3.new(0,0,0)
}
function teleportPlayer(player)
if player.Character then
player.Character:PivotTo(CFrame.new(_CFrame.position,_CFrame.orientation))
end
end
teleportPlayer(player) --Run this whenever you need to.
If you want to teleport someone to a part, try this
local Part = game.Workspace.Part -- Your part goes here
game.Players.PlayerAdded:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
HumanoidRootPart.CFrame = Part.CFrame
end)
Ps. “Play Here” makes you character spawn on the position of your camera in studio.
it still does nothing, though when I instead of press “Play” I press “Play Here” it does work, is this maybe because of the SpawnPoint? Does it do something that prevents the player from teleporting?
I mean the button that you click to play your game in studio, It has 3 options, Play, Play Here and Run, When i Click Play i doesnt teleport the player and when I Click Play Here it does work for some reason.