CFrame Rotation not set correctly

I’m having an issue with setting rotation via script in Roblox. When I manually set the rotation to (10, 90, 0) in Studio, it stays correct. But when I set it in a script, it changes to (0, 90, 10), causing an incorrect rotation.

Here’s my code:

local Rotation = script.Parent.Rotation
local Ball = script.Parent.goal
local BallPos = script.Parent.BallPos
local UnCtrl = script.Parent.unctrl
local Input = script.Parent.ctrl.Input
local RunService = game:GetService("RunService")

local BaseInput = Input.CFrame
local BasePos = Ball.Position
local BaseCframe = UnCtrl.CFrame

local function setInput(x)
	-- Expected (10, 90, 0), but gets set to (0, 90, 10)
	Input.CFrame = CFrame.new(Input.CFrame.Position) * CFrame.Angles(math.rad(x * 90), math.rad(90), 0)
end

local function resetGame()
	Ball.Position = BasePos
	Input.CFrame = BaseInput
	UnCtrl.CFrame = BaseCframe
end

RunService.Heartbeat:Connect(function()
	Rotation.Value = (UnCtrl.Rotation.Z) / 90
	BallPos.Value = Ball.Position.X / UnCtrl.Size.Z
end)

setInput(0.1)

Thanks in advance

I just found a solution by mysef by replace this part of code

local function setInput(x)
	Input.CFrame = CFrame.new(Input.CFrame.Position) * CFrame.Angles(math.rad(x * 90), math.rad(90), 0)
end

by

local function setInput(x)
	Input.CFrame = CFrame.new(Input.CFrame.Position) * CFrame.fromOrientation(math.rad(x * 90), math.rad(90), 0)
end