Does anyone know why this code doesn’t work?
function Click()
script.Parent.Orientation.X = script.Parent.Orientation.X + 90
end
script.Parent.ClickDetector.MouseClick:Connect(Click)
I want to make it so the part rotates.
Does anyone know why this code doesn’t work?
function Click()
script.Parent.Orientation.X = script.Parent.Orientation.X + 90
end
script.Parent.ClickDetector.MouseClick:Connect(Click)
I want to make it so the part rotates.
You can not just assign a new X to it like that. You would have to do it like this:
function Click()
script.Parent.Orientation += Vector3.new(90,0,0)
end
script.Parent.ClickDetector.MouseClick:Connect(Click)
If you are wondering what +=
is take a look at the api-reference on compound operators here
Duplicate post of Part Position Issue - Help and Feedback / Scripting Support - DevForum | Roblox
If @OwlCodes solution helped you, mark it as solved.
One more thing, you should probbably define script.Parent as something.
so like:
local clickedModel = script.Parent
Then use that in your scripts. It makes you’re code a bit more readable.
On that note, check the output. It will give you an error and you can find the solution (such as this other post) by googling it.