Hello, my teleport player script is not working. I have tried for a while to fix this issue but it is not being resolved. So here is my script, can anyone help me fix it?
player.Character.HumanoidRootPart.CFrame = game.Workspace.WaitingRoom.WaitingSpawn.CFrame + Vector3.new(0,5,0)
end
Please check your code since it will infact error when you use CFrame.new(0,5,0) since you are not giving it a proper Vector3 Value. Using Vector3.new(0,5,0) works fine.
You do not need to use SetPrimaryPartCFrame for this purpose. Moving the HumanoidRootPart alone is fine as it is already the PrimaryPart of a normal ROBLOX character rig.
Ok, here is my full script, I am using an AlvinBlox script because I just started scripting.
local character = game.ServerStorage.Piggy:Clone()
character.Name = piggy.Name
piggy.Character = character
character.Parent = workspace
end
function module.TeleportPiggy(player)
if player.Character then
player.Character.Humanoid.WalkSpeed = 18
player.Character.Humanoid.JumpPower = 15
local bat = game.ServerStorage.Tools.PiggyBat:Clone()
bat.Parent = player.Character
if player.Character:FindFirstChild("HumanoidRootPart") then
player.Character.HumanoidRootPart.CFrame = game.Workspace.WaitingRoom.WaitingSpawn.CFrame + CFrame.new(0,5,0)
end
Nothing against using script tutorials, but why ask the DevForum? Alvin’s videos are sure to work as he tests them frequently. The correct answer is already in the video.