I want to know how to approach Orientation in the model with a script

I want to know how to approach Orientation in the model with a script.

local occupantplr = seat.Occupant.Parent:GetPivot()
	

	local Pos = player:WaitForChild("HumanoidRootPart")   --닿는 플레이어 위치찾기

	local PosCframe = Pos.RootRigAttachment.WorldCFrame.Position  --닿는 플레이어 위치찾기

	--local varX = carpos:GetPivot().X*0.2*script.Parent.AssemblyLinearVelocity.Magnitude / 10  -- 모델위치
	--local varZ = carpos:GetPivot().Z*0.2*script.Parent.AssemblyLinearVelocity.Magnitude / 10
	
	print(occupantplr)
	
	if humanoid and  seat.Occupant ~= nil and Enabled  then
		
		if occupantplr.Orientation.Y >=80 and occupantplr.Orientation.Y >=95  then
			Enabled = false
		player:MoveTo(Vector3.new(occupantplr.X*0.3,0,0))
			fall:play()

			wait(2)
			Enabled = true
			
		elseif occupantplr.X-PosCframe.X >-1 then
			Enabled = false
			player:MoveTo(Vector3.new(occupantplr.X +10,0,0))
			fall:play()

제목 없음

What are you trying to do exactly?

I’m trying to find the direction the player in the car is looking at.

Trough the Model‘s orientation?
If yes simply do:

local model = modelName

And when you need the Orientation do:

model.Orientation

Never acces Orientation from a Variable, as it will always return the same even if it’s changed

I did that, but an error occurred.

er

code
local occupantplror = seat.Occupant.Parent
occupantplror.Orientation.Y

A model does not have an orientation property.

You can simply get the orientation of the humanoid root part
which is exactly the same:

occupantplror.HumanoidRootPart.Orientation.Y
1 Like

Thank you. I got the value I wanted.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.