how can I make a model rotate here is what I’ve tried
NewObject:PivotTo(NewObject:GetPivot() * CFrame.Angles(0,math.rad(Rotation),0))
but its not working idk why
how can I make a model rotate here is what I’ve tried
NewObject:PivotTo(NewObject:GetPivot() * CFrame.Angles(0,math.rad(Rotation),0))
but its not working idk why
Is this the entire script? Doesn’t’ seem it like it is…
no its not I don’t need to supply the whole script this tells the whole story and its 120+ lines
What’s exactly happening is there errors in the output or is it just not rotating whatsoever
no errors but its just not rotating
Please add print statements leading up to this part in the code, the code youve shown is fine, it must be something else.
ok ill try to print stuff with it
have you tried debugging it? Perhaps it’s not getting executed, put a print statement above and below it, and above and below that too.
So for example:
– code
– print statement here
– code
– print statement here
– rotate object line here
– print statement here
– code
– print statement here
– code
just finished printing checks and it passed all of them the code before and after that line ran like I wanted it to idk what happening
Try this instead
local pivot = YourModelHere:GetPivot()
YourModelHere:PivotTo(pivot * CFrame.Angles(math.rad(-3),0, 0))
I have an idea to fix this I will reply back when I finish it
I just tried that and noting happened but ima go try my idea rq
It works for me, whats the rest of your script?
ooh I just realized something its in a local script on a part that doesn’t exist on the server… would that effect it not working?
If you use a localscript, the code will only run on the client, meaning it won’t show for other players. Change it to a serverscript.
no no no I’m working on a sandbox building script it needs to be for one player only but its not working on a local script
Apologies for the late reply, next time please reply back to me.
I’m not sure what else to tell you to be honest, I don’t know much about your situation.
Is it rotated in a loop? If not I don’t think you need to use math.rad(), though I’m not sure if that would solve anything, I’m not good with the math global, however maybe if the Rotation variable is too small of a number, maybe that’s why you don’t see a difference?
So you want players not to see each other’s buildings? Can you show us the rest of your code?
ok its a little messy lol but ill send
local function RotateObject(Key, Processed)
if not Processed and Key.KeyCode == Enum.KeyCode.R then
if NewObject then
if CanPlace == true then
Rotation += RotationAmount
print(Rotation)
NewObject:PivotTo(NewObject:GetPivot() * CFrame.Angles(0 ,math.rad(Rotation), 0))
print("Rotated")
end
end
elseif not Processed and Key.KeyCode == Enum.KeyCode.T then
if NewObject then
if CanPlace == true then
Rotation -= RotationAmount
print(Rotation)
NewObject:PivotTo(NewObject:GetPivot() * CFrame.Angles(0,math.rad(Rotation),0))
print("Rotated")
end
end
end
end