I am making a place-able chair for my game Ba Hood. When you equip the chair as a tool, a preview of the chair appears locally at the position of your mouse. When holding R while in the preview mode, the preview rotates. By clicking, the client fires a remote event to the server, telling the server where to place the chair and in what rotation by checking the preview’s position and rotation, which causes another script to clone the chair to that position. If placing the chair while it is rotated in the preview, the chair spawns in that rotation. I use Vector3 to acquire this.
The problem is that after rotating the chair more than 90 degrees, instead of adding to the amount of degrees sending to the server, the client starts subtracting. For example, if I rotate the chair up to 90 degrees, the placement works fine, but after rotating the chair one more degree, the client sends the rotation of 89 degrees, and after rotating the chair two more degrees, the client sends the rotation of 88 degrees to the server. This continues down all the way to negative 90 degrees, when it starts going up again and works fine.
I have looked at the Roblox Documentation about vector3 and rotation where I have not found any clue to why this happens. I have also tried to learn about how CFrame rotation works, which I do not understand anything of.
I am using these lines of code to check and send the position and rotation:
local pos = mouse.Hit.p + Vector3.new(0, 2, 0)
local rot = script.Parent.Chair.Rotation.Y
script.Parent.AddBlock:FireServer(pos, rot)
Do you know why this happens? Is this how vector3 rotation works? Do you know of a solution? All help greatly appreciated!
P.S adding a video of what that happens. The output from the console is the amount of degrees the client tells the server to rotate the chair, printed from the client script.