Help rotating a model

Any errors in the output? Does the script print “Rotated”?

yea it does print rotated but no errors I have no idea what’s going on this is crazy

I tried what u said still nothing works

Can you verify that Rotation and math.rad(Rotation) are not 0.

yes I can verify it goes by 5’s and they print not 0

Can you verify that NewObject is the correct object?

Another thing is the verify that NewObject has a PrimaryPart
(could be wrong but i think :PivotTo() requries one)

How about setting CanPlace = false after setting it = true?

I don’t think setting it false would help any it would do nothing

yes all objects have primary parts

And the NewObject? Is it the correct object in the workspace

yep it is just checked how is it not working?

To be honest, trying to make a client-sided building system is destined for problems. I would make your building system show for all players.

Okay, im out of ideas now.
If you want you can message me a placefile and ill be happy to look further incase theres something you missed.

  1. The rotation logic increases or decreases the Rotation variable by RotationAmount but applies the entire Rotation angle each time, which may not be intended if Rotation accumulates values beyond 360 degrees or below 0 degrees.

  2. You might want to normalize Rotation to ensure it stays within a valid range (0 to 360 degrees). This will prevent potential issues with excessive rotation values.


local Rotation = 0 -- Ensure Rotation starts at 0
local RotationAmount = math.rad(45)


local function RotateObject(Key, Processed)
    if not Processed then
        if NewObject then
            if Key.KeyCode == Enum.KeyCode.R then
                Rotation = (Rotation + RotationAmount) % (2 * math.pi) -- Normalize Rotation
                NewObject:PivotTo(NewObject:GetPivot() * CFrame.Angles(0, Rotation, 0))
             
                
            elseif Key.KeyCode == Enum.KeyCode.T then
                Rotation = (Rotation - RotationAmount) % (2 * math.pi)
                NewObject:PivotTo(NewObject:GetPivot() * CFrame.Angles(0, Rotation, 0))
                print("Rotation after T key: " .. Rotation)
                print("Rotated counterclockwise")
            end
        end
    end
end

just put ur code to my code and out still doesn’t happen

Show me ur full code please so I can understand better. Because it should be working

ok ill dm u it if I can ill figure it out lol

1 Like

He’s just trying to work out the positioning and rotating aspect of the placement system… not the networking involved in actually displaying the builds to other clients.

From what he told me above it sounds like he’s trying to display the builds to only one client.

If this is a model, try this…

NewObject:SetPrimaryPartCFrame(NewObject.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(Rotation), 0))

When you use the PivotTo and GetPivot methods, the model needs to have a primary part set so that it knows which part to use as the reference point for the pivot. Not 100% sure I did that right as I didn’t test anything. But this is something you need to have in place (PrimaryPart) when working with models.