So I have a MODEL I need to be rotated when you press R. The script I'm using below won't work because you can't CFrame a model, correct? Well, it was brought to me I should use SetPrimaryPartCFrame. I'm not to sure how to use it though.

What should I replace, or how should I add SetPrimaryPartCFrame functions instead of CFrame to the code below?

model = game.Lighting.Chair.ChairSeat

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.R then
        model.PrimaryPart.CFrame = model.PrimaryPart.CFrame*CFrame.fromEulerAnglesXYZ(0,math.pi/5,0)
    end
end

5 comments

0

Are there any errors?

0

Yes. "PrimaryPart is not a valid member of UnionOperation"

0

Is game.Lighting.Chair.ChairSeat a model?

0

Oh. game.Lighting.Chair is a model. I removed the .ChairSeat part, now I'm not getting any errors. But the rotation thing still doesn't work.

0

Basically, when you select a tool, a chair spawns in that will let you freely place it where ever you want on your claimed land. I want to make it when they select that tool, and gives them the ability to place, they can also rotate it.