I've never understood it. Whenever i try to CFrame a local part, it moves somewhere completely different from where i want it to be... Help?
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) local bin = Instance.new("Message",char) local part = Instance.new("Part",bin) part.CFrame = CFrame.new(0,10,0) end) end)
The code above puts it around my spawn instead of around the co-ordinates 0,10,0
I am REALLY confused.
Try this and tell me if it works. objectspace is the position the character spawned at (measured at ground level), and positions the part to the given position by subtracting the objectspace.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) local objectspace = char.Torso.Position - Vector3.new(0,3,0) local function coord(position) return position - objectspace end local bin = Instance.new("Message",char) local part = Instance.new("Part",bin) part.CFrame = CFrame.new(coord(Vector3,new(0,10,0))) end) end)
CFrame has two parameters, both being Vector3 values. It can stuff up if your provide 3 values, or only one of them.
Parameter 1
being it's position, and Parameter 2
being where it's facing.
part.CFrame = CFrame.new(Vector3.new(0,10,0),Part.Position + Vector3.new(0,0,2)) --the 2nd parameter: parts stuff up if you make them look at themselves :/