Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to set this Vector3 orientation in a CFrame?

I need a rotation inside a CFrame because otherwise the part will keep teleporting because the game thinks it's inside another brick :/ I don't know how to do this though

This is the orientation

Vector3.new(laser.Orientation.X + 90, laser.Orientation.Y, laser.Orientation.Z)

This is what I tried

local head = script.Parent
local LTP = script.Parent.Parent:WaitForChild('LockToPart')

while wait() do
	if workspace:FindFirstChild('laser') then
		local laser = workspace.laser
		local rot = laser.Orientation
		head.CFrame = CFrame.new(head.Position) * CFrame.Angles(math.rad(laser.Orientation.X), math.rad(laser.Orientation.Y), math.rad(laser.Orientation.Z)) 
		
	--	head.Orientation = Vector3.new(laser.Orientation.X + 90, laser.Orientation.Y, laser.Orientation.Z)
	end
end

1 answer

local head = script.Parent
local LTP = script.Parent.Parent:WaitForChild('LockToPart')

while wait() do
    if workspace:FindFirstChild('laser') then
        local laser = workspace.laser
        local rot = laser.Orientation
        head.CFrame = CFrame.new(head.CFrame) * CFrame.Angles(math.rad(laser.Orientation.X), math.rad(laser.Orientation.Y), math.rad(laser.Orientation.Z)) 

    --  head.Orientation = Vector3.new(laser.Orientation.X + 90, laser.Orientation.Y, laser.Orientation.Z)
    end
end

hope that shall help i didint test it but still try it

4 comments

0

so i made Position to CFrame instad of position cuz vector 3 cuz vector 3 looks liek this : X,Y,Z and CFrame has more numbers it will do the same as u want i think

0

I have no clue what you are thinking but you can't make a CFrame with a CFrame dude

0

hmm weird for me i need to use cframe

0

You CANNOT use CFrame inside A CFrame, a cframe already has rotation data inside it. This script will result in an error

This discussion is preserved as it was. New answers, comments, and votes are closed.