When teleporting part infront of player, it doesn't face the way i'm facing

the orientation of the part is lost when i teleport it

for some reason it just goes flat
also, how would i weld it so it stays where i want it to but still moves with the player?

local script

local player = game.Players.LocalPlayer
local book = game.Workspace.KieranBook
local event = game.ReplicatedStorage.KieranBookEvent

player.Chatted:Connect(function(msg)
	if string.find(msg:lower(), "summon book") then
		event:FireServer()
	end
end)

server script

local event = game.ReplicatedStorage.KieranBookEvent
local book = game.Workspace.KieranBook

event.OnServerEvent:Connect(function(player)
	book.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5) * CFrame.Angles(0, 100000, 0)
end)

book after summoned
image

book in studio
image

what is Cframe.Angles(0, 10000000, 0)

its how i put the book in front of the player

remove it.

how would i weld it though?

that also didn’t fix the orientation btw

but when i try motor6d the player gets put in the book

any screenshot ?-------------------

image

any help? ---------------- i sent the screenshot

put

* CFrame.Angles(0, 0, 0)

what about the weld issue???

still doesn’t fix orientation issue, its just a flat book however ive fixed this myself. i just need help with the welding and making the book face the way im facing

also, this doesn’t make the book face the way I’m facing

how do i do that

any help…? anyone

aaaaaaaaaaaaaaaaaaaaaaa

You need to use CFrame:ToWorldSpace() to have an offset based on a specific CFrame.

local rootPart = player.Character.PrimaryPart --AKA HumanoidRootPart
book.CFrame = rootPart.CFrame:ToWorldSpace(CFrame.new(0, 0, -5) * CFrame.Angles(math.rad(45), 0, 0))

Axis directions are unclear in world space, so tinker with the values until you have the desired positioning. Be sure to use math.rad() for orientations, because Angles takes values in radians and not degrees.

1 Like

Also, the reason the book is flat is because setting its CFrame to the CFrame of another thing also overrides the rotation. You would have to combine a position only CFrame with a rotation only CFrame to keep the orientation.

part.CFrame = CFrame.new(otherPart.Position) * part.CFrame.Rotation

1 Like

I’ve fixed the flat issue, however it still doesn’t face the way I face.

so for example, if i face forward i want the book to face forward too
the open side will face me and the back will face forward if that makes sense

heres a few screenshots of what i mean

so the book will summon like this
image

image


What does the updated code look like now? Could you send it in a codeblock

I haven’t updated the code yet
i will do it now

local event = game.ReplicatedStorage.KieranBookEvent
local book = game.Workspace.KieranBook
local orientation = book.Orientation

event.OnServerEvent:Connect(function(player)
	local rootPart = player.Character.PrimaryPart --AKA HumanoidRootPart
	book.CFrame = rootPart.CFrame:ToWorldSpace(CFrame.new(0, 0, -5) * CFrame.Angles(math.rad(45), 0, 0))
	book.Orientation = orientation
	local weld = Instance.new("Motor6D")
	weld.Parent = book
	weld.Part0 = book
	weld.Part1 = player.Character.HumanoidRootPart
end)

So the book doesnt face the same way your humanoidrootpart is facing, what does it look like in game?