Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do I use SetPrimaryPartCFrame?

Asked by 8 years ago

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
0
Are there any errors? PreciseLogic 271 — 8y
0
Yes. "PrimaryPart is not a valid member of UnionOperation" SirBrayden 35 — 8y
0
Is game.Lighting.Chair.ChairSeat a model? User#11440 120 — 8y
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. SirBrayden 35 — 8y
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. SirBrayden 35 — 8y

Answer this question