How do I move a player? I tried doing this but it throws this error —CFrame is not a valid member of Player “Players.Mrvictory711”
local foroffsetCFrame = CFrame.new(0, 500, 0)
plai.Character.CFrame = plai.CFrame:ToWorldSpace(foroffsetCFrame)
--alternatively also .Character.Humanoid
When I just did
plai.CFrame:ToWorldSpace(foroffsetCFrame)
It said CFrame is not a valid property of Player
iondrive
(iondrive)
3
plai.Character is a Model wich doesnt have a CFrame
Do plai.Character.HumanoidRootPart.CFrame instead
Nerbzzz
(Nikki)
5
plai.Character:SetPrimaryPartCFrame(CFrame)
or the new pivot one which is way better
You need to set the CFrame of the players character’s HumanoidRootPart, not the player/character it self
Proville6
(Proville6)
7
Use PivotTo, example code:
local foroffsetCFrame = CFrame.new(0, 500, 0)
plai.Character:PivotTo(foroffsetCFrame)
Theres 2 options:
local plr = game:GetService("Players")
local char = plr.Character
repeat wait() until char ~= nil
local hrp = char:WaitForChild("HumanoidRootPart")
hrp.CFrame = CFrame.new(0, 500, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
-- could also be:
hrp.CFrame = workspace["Part Name"].CFrame
or
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character
repeat wait() until char ~= nil
plr:MoveTo(workspace["Part Name"].Position)
ogapogie
(barry)
9
I’d pick the first one if you want to be more specific.
Instead of doing repeat wait() until char ~= nil do
local char = plr.Character or plr.CharacterAdded:Wait()