Cframe value wont print correctly

Alright. I’m having a little difficulty reading the code, so I’ll give you a working system and you can learn from it or build it up from there. Also, the LocalScript should know when the player joined and it shouldn’t need a RemoteEvent for that. Here is a function you can call or link to a RemoteEvent which will spawn the player on a random spawn whenever it is called.

local spawns = { -- side note, the spawns probably don't need this degree of accuracy. You should be able to round off all of those decimals.
	CFrame.new(64.65, 16105.011, -3289.95),
	CFrame.new(114.65, 16105.011, -3289.95),
	CFrame.new(164.65, 16105.011, -3289.95),
	CFrame.new(214.65, 16105.011, -3289.95)
}

local function spawnPlayer(player)
	local character = player.Character or player.CharacterAdded:Wait() -- Get the character. If it doesn't exist, wait for the event ChildAdded to be called.
	local hrp = character:FindFirstChild("HumanoidRootPart") or character:WaitForChild("HumanoidRootPart", 3) -- Get the HumanoidRootPart if it exists, or wait for it to exist. I can't remember if you need to recursively check for things to exist like this, but it won't hurt.
	hrp.CFrame = spawns[math.random(#spawns)]
end

to rotate simply add an CFrame.Angles() or if want to rotate and set pos then do CFrame.new() * CFrame.Angles()

1 Like

Try doing print(picked_value.Position) it gets the position of the CFrame without those extra numbers.

1 Like

thank you! I will try to use this to the best of my abilities!

1 Like

I’ll try that to see if it works

okay, so it errors telling me I need a CFrame instead of a vector3

are the positions still in CFrame.new or did you change them to Vector3.new because it should work if it’s in CFrame.new

well how would I change vector 3 to Cframe?

when I try to run the character part of the script it errors (might be something that was changed in roblox scripting)

What’s the error and where do you implement it?

I put it in a local script in starter player scripts.

That’s not from my code I don’t think. Just to let you know though, the code I gave you should go in a Script, not a LocalScript.

1 Like