Help With Rotation

I am trying to make a part rotation to stay 0,0,-90 and if it’s not then I want the part to flip back to 0,0,-90. When I try this read lines appear and I don’t. know way. Can someone help me out.

-- SERVER SCRIPT LOCATED IN PART
-- <<VARIABLES>>
local part = script.Parent
local runService = game:GetService("RunService")

-- <<FUNCTIONS>>
-- Function to continuously update part's velocity, simulating deceleration
	local function updateVelocity()
		if part.Rotation == 0,0,-90 then
			return end
		if part.Rotation not == 0,0-90 then
			part.Rotation = 0,0,-90
		end
end

-- <<CONNECTIONS>>
runService.Heartbeat:Connect(updateVelocity)  -- Connect the updateVelocity function to the Heartbeat event

I got it

-- SERVER SCRIPT LOCATED IN PART
-- <<VARIABLES>>
local part = script.Parent

-- <<FUNCTIONS>>
-- Function to continuously update part's rotation
local function updateRotation()
	if part.Rotation == Vector3.new(0, 0, -90) then
		return
	else
		part.Rotation = Vector3.new(0, 0, -90)
	end
end

-- <<CONNECTIONS>>
while true do
	wait(1)
	updateRotation()
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.