i have a indicator at the middle of face 1 but when i spin its not accurate to the indicator local soulFragmentRewardsDefault = {
10, 20, 70, 50, 10, 20, 70, 10,
20, 70, 50, 10, 20, 70, 50, 10
}
local spinCost = 10
local active = false
local lastPlayer
local wheelFolder = script.Parent -- The "Wheel" folder
local motor = wheelFolder.Motor:FindFirstChildOfClass("HingeConstraint")
local prompt = wheelFolder.Button:WaitForChild("ProximityPrompt")
local screenPart = wheelFolder:WaitForChild("Screen")
local surfaceGui = screenPart:WaitForChild("ScreenGui")
local label = surfaceGui:WaitForChild("Label")
local function updateScreenText(text)
label.Text = text
end
-- 🎯 Get reward based on adjusted angle (offset aligns with arrow)
local function getReward(angle)
-- Offset by 11.25 degrees so face centers align with arrow
angle = (angle + 11.25) % 360
local faceSize = 360 / 16
local faceIndex = math.floor(angle / faceSize) + 1
local localAngle = angle % faceSize
local centerZoneHalfSize = 3
local centerAngle = faceSize / 2
if faceIndex == 1 then
if math.abs(localAngle - centerAngle) <= centerZoneHalfSize then
return 1000
end
elseif faceIndex == 8 then
if math.abs(localAngle - centerAngle) <= centerZoneHalfSize then
return 500
end
end
return soulFragmentRewardsDefault[faceIndex] or 10
end
local function addSoulFragments(player, amount)
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then return end
local soulFragments = leaderstats:FindFirstChild("Soul Fragments")
if soulFragments and soulFragments:IsA("IntValue") then
soulFragments.Value += amount
end
end
local function awardSoulFragments(player, angle)
local reward = getReward(angle)
addSoulFragments(player, reward)
return reward
end
local function spinWheel()
updateScreenText("Spinning...")
motor.MotorMaxAcceleration = 10
motor.AngularVelocity = 10 + math.random()
task.wait(2 + 3 * math.random())
motor.MotorMaxAcceleration = 1
motor.AngularVelocity = 0
task.wait(10) -- wait for wheel to settle
local reward = awardSoulFragments(lastPlayer, motor.CurrentAngle)
updateScreenText("You won " .. reward .. " Soul Fragments! Press E to spin again.")
active = false
prompt.Enabled = true
end
prompt.Triggered:Connect(function(player)
if active then return end
local stats = player:FindFirstChild("leaderstats")
if not stats then return end
local soulFragments = stats:FindFirstChild("Soul Fragments")
if not soulFragments then return end
if soulFragments.Value >= spinCost then
soulFragments.Value -= spinCost
lastPlayer = player
active = true
prompt.Enabled = false
task.spawn(spinWheel)
else
updateScreenText("You need at least " .. spinCost .. " Soul Fragments to spin!")
end
end)
-- Initial screen text
updateScreenText("Ready to play!")