I’m making a plugin that randomizes the Orientation of parts to make it easier for me to randomize rocks and decorations.
This code keeps erroring randomly (5-10% chance)
local mouse = plugin:GetMouse()
mouse.Button1Down:Connect(function()
print("Down")
if mouse.Target and IsSelecting then
if Values.X.Value == true then
mouse.Target.Orientation = Vector3.new(math.random(0,180), mouse.Target.Orientation.Y, mouse.Target.Orientation.Z)
end
if Values.Y.Value == true then
mouse.Target.Orientation = Vector3.new(mouse.Target.Orientation.X, math.random(0,180), mouse.Target.Orientation.Z)
end
if Values.Z.Value == true then
mouse.Target.Orientation = Vector3.new(mouse.Target.Orientation.X, mouse.Target.Orientation.Y, math.random(0,180))
end
end
end)
18:12:28.961 - user_Rotation Randomizer.rbxmx.Rotation Randomizer.Main:120: attempt to index nil with 'Orientation'
18:12:28.962 - Stack Begin
18:12:28.963 - Script 'user_Rotation Randomizer.rbxmx.Rotation Randomizer.Main', Line 120
18:12:28.964 - Stack End