Hello. So, I have it when you select a tool, a model will spawn that lets you freely place it on your claimed land. It works perfectly. But now I need rotation.
How do I add a rotation feature using the R key?
Hello. So, I have it when you select a tool, a model will spawn that lets you freely place it on your claimed land. It works perfectly. But now I need rotation.
How do I add a rotation feature using the R key?
Ok, so you need two things here.
how to do something on r press
how to rotate a model
model = something:FindFirstChild("Whatever").Anything
for q=1,360 do
model:SetPrimaryPartCFrame( --you'll need a primary part
model:GetPrimaryPartCFrame()* --the current cframe
CFrame.Angles(math.rad(1),0,0) --rotate
)
end
I'm assuming you already know how to do things when you press a key, but if you don't, tell me in a comment.
As for the r pressing, do that like this.
game:GetService("UserInputService").InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.R then
--do some rotate stuff
end
end)
The only way I know is using KeyDown. I tried, and couldn't get it to work. Mind editing your answer and adding the "Press R" function to the current code. Thanks!
It's not working. This needs to be in a onClicked function because it is when a user selects the tool. When they select the tool, they will be able to press "R", and rotate the item. How would I do this?
Nice answer <3
Thanks :D
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
edited
Dude, I answered your question. If you want to know how to make a click function, ask another one.