Hello, I’m working on a small project, And my Scripted Model Orientation doesn’t work, And I’m not sure why, so my objective is too find out how to fix this problem.
Here is my code
local ss = game:GetService("ServerStorage")
local mf = ss:WaitForChild("Markers"):GetChildren()
local sp = workspace:FindFirstChild("MarkerSpawns")
local Part = game.Workspace.Part
local tmf = {
mf[1]:Clone(),
mf[2]:Clone(),
mf[3]:Clone(),
mf[4]:Clone(),
mf[5]:Clone(),
mf[6]:Clone(),
mf[7]:Clone()
}
for _,v in pairs(tmf) do
wait(1)
v.Parent = workspace
wait(1)
v.PrimaryPart = v.Center
local cf = Part.CFrame * CFrame.new(math.random(-Part.Size.X/2, Part.Size.X/2),(0),math.random(-Part.Size.X/2, Part.Size.X/2))
v:SetPrimaryPartCFrame(cf * CFrame.Angles(math.rad(0),0,-90) + Vector3.new(0,-11.550,0))
end
Well what are you trying to accomplish? What does “Scripted Model Orientation doesn’t work” really mean? You need to be a bit more specific with your question.
Currently, the Markers are successfully being placed more or less randomly, what else are you looking for?
I mean when I change my model orientation through the script It doesn’t change it’s orientation to -90, It’s changes to a whole other number. My markers are being successfully, It’s just the orientation. And I’m not looking for anything else.
I have found out the problem, The problem is that math.rad(), turns your degrees into radians, Meaning you might want 90 degrees but since math.rad() turns that into radians you are going to have 5156.6201562°. To fix this problem, search up Degrees to Radians calcautor, and you know the rest.
For -90 degrees to radians you can either use Lua’s math library function math.rad(-90) to get the value in radians or simply -math.pi/2. Pi radians represents 180 degrees.