Rotating model when pressing R key not working.
I am trying to rotate a model when I press the R-key, but it does not seem to work. Why?
What am I doing wrong?
I have made sure that cloneModel does exist, I have made sure of that earlier in my script. Therefore, I have not included it here because it is too much code to put into here.
Any help with this is greatly appreciated!
r = 0
rotating = false
uis.InputBegan:connect(function(inst)
if Rotating == false then
if inst.KeyCode == Enum.KeyCode.R then
rotating = true
r = r + 90 cloneModel:SetPrimaryPartCFrame(CFrame.new(cloneModel.PrimaryPart.Position) * CFrame.Angles(0,0,math.rad(r)))
if r == 360 then
r = 0
end
end
Rotating = false
end
end)

4 comments
What is the other code? All you have to do is Copy paste. Does it give you any errors? Your tabbing is like... excessive
The other code is for an highly advanced model-placement system.. 400 lines long.. just..no. And btw it does not give me any errors.
Are you getting the player input from a Server script, or are you trying to move the block with a Local Script? If so, your script is either unable to access player input or rotate the block on the server level, respectively. Such is due to the script not being the appropriate type.
Server scripts cannot access player input, nor can Local Scripts change an object's position and replicate it to the server; local scripts can only change an object's position for your client. The new position would not be reflected on the server, and thus, to other players.