How to make it stop rotating the Y and Z?

I want it to stop rotating in the Y and Z orientation if the y and z is set to 0 and the wheel itself is also in orientation 0 then it works fine but i think because y and z sometimes is set to 180 when spinning it messes up. Or is it because of vector3?

It rotates in every direction

I have tried changing the angle

local Wheel = script.Parent -- Get a reference to the wheel object

local clickDetector = Wheel:WaitForChild("ClickDetector") -- Get a reference to the ClickDetector inside the wheel

local Replicated = game.ReplicatedStorage
local RewardsFolder = Replicated.Rewards
local Hamburger = RewardsFolder.Hamburger
local Milk = RewardsFolder.Milk
local Pizza = RewardsFolder.Pizza
local Health = RewardsFolder.Health

local rewards = {500, Pizza, 200, Hamburger, 100, Milk, 250, Health} -- Define a table of rewards

local tweenService = game:GetService("TweenService") -- Get a reference to the TweenService

local isSpinning = false -- Variable to track if the wheel is currently spinning

local Claimed = false

clickDetector.MouseClick:Connect(function(plr) -- Connect a function to the MouseClick event of the ClickDetector
	
	local TimeManagement = plr:WaitForChild("TimeManagement")
	local SpinTime = TimeManagement.FortuneReward
	local TimeValue = SpinTime.Value
	local Reward = game:GetService("ReplicatedStorage").Events:FindFirstChild("Fortune")
	
	
	if SpinTime.Value <= 0 and Claimed == false then
		if isSpinning then return end -- If the wheel is already spinning, exit the function

		isSpinning = true -- Set the isSpinning variable to true to prevent multiple spins at the same time

		local rewardIndex = math.random(1, #rewards) -- Choose a random index from the rewards table

		local angle = rewardIndex / #rewards * 360 - (360 / #rewards / 2) -- Calculate the angle at which the wheel should stop
		local offset = -math.random() * 360 / #rewards -- Add a random offset to the angle for visual variety
		local spins = math.random(5, 10) * 360 -- Add a random number of extra spins to the angle
		angle += offset + spins -- Calculate the final angle

		local spinTime = math.random(2, 10) -- Choose a random spin time

		local tweenInfo = TweenInfo.new(spinTime, Enum.EasingStyle.Quint, Enum.EasingDirection.Out) -- Create TweenInfo with the chosen spin time and easing options

		local tween = tweenService:Create(Wheel, tweenInfo, {Rotation = Vector3.new(angle, -42.147, 0)}) -- Create a Tween that animates the wheel's rotation to the target angle
		tween:Play() -- Start the Tween animation

		tween.Completed:Wait() -- Wait for the Tween animation to complete

		local rewardItem = rewards[rewardIndex] -- Get the rewarded item at the chosen index

I think you can try at the line where you set “tween” variable: {Rotation = CFrame.Angles(x,y,z)} and try to experiment with the angles.

the rotation property is in world space not object space. you’d want to take the wheel’s current CFrame and figure out what axis it rotates on to spin in the way you wish and rotate it by a certain amount on that axis.

Use a weld to connect the spinner to its bearing and tween the C0 of the weld instead of the part’s cframe

I have changed the script and it doesn’t spin in the Y and Z but now it only spins for a short amount and not the 5 to 10 spins it is set too and i dont know why, it does spin to the correct reward tho. I have changed the script to this.

local rewardIndex = math.random(1, #rewards) -- Choose a random index from the rewards table

		local angle = rewardIndex / #rewards * 360 - (360 / #rewards / 2) -- Calculate the angle at which the wheel should stop
		local offset = -math.random() * 360 / #rewards -- Add a random offset to the angle for visual variety
		local spins = math.random(5, 10) * 360 -- Add a random number of extra spins to the angle
		angle += offset + spins -- Calculate the final angle

		local spinTime = math.random(2, 10) -- Choose a random spin time

		local tweenInfo = TweenInfo.new(spinTime, Enum.EasingStyle.Quint, Enum.EasingDirection.Out) -- Create TweenInfo with the chosen spin time and easing options

		local tween = tweenService:Create(Wheel, tweenInfo, {CFrame = Wheel.CFrame * CFrame.Angles(math.rad(angle), 0, 0)}) -- Create a Tween that animates the wheel's rotation to the target angle
		tween:Play() -- Start the Tween animation

		tween.Completed:Wait() -- Wait for the Tween animation to complete

you may need to put it in a for loop to make it spin more, angle appears to only move once unless i am missing something