Hi, I’m making a building system, but I can’t rotate a model using SetPrimaryPartCFrame
, here is the code that I am using:
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then
return
else
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if goodToPlace == true then
Place:InvokeServer(new.PrimaryPart.Position, new.Name)
runConnection:Disconnect();
IsPlacing = false;
goodToPlace = nil;
new:Destroy()
end
elseif input.KeyCode == Enum.KeyCode.R then
warn("Rotating");
local newCFrame = new:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(-90), 0);
new:SetPrimaryPartCFrame(newCFrame)
end
end
end)
Help is appreciated!