Trying to use Origin Orientation to make my coin spin

Hello, I’m new to scripting and i wanna make my coin spin on the Y axis to make it a little more dynamic but when i use the orientation it says “Y cannot be assigned”


local debounceTime = 1
local canCollect = true

local function onTouched(hit)
	if not canCollect then return end

	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		local stats = player:FindFirstChild("leaderstats")
		if stats then
			local coins = stats:FindFirstChild("Coins")
			if coins then
				canCollect = false
				coins.Value = coins.Value + 1

				-- Optional: Add sound or particle effect here
				coin.Transparency = 1
				coin.CanCollide = false

				wait(debounceTime) -- Time before coin respawns

				coin.Transparency = 0
				coin.CanCollide = true
				canCollect = true
				
				--- Changing the coins orientation ---
				while true do
					wait(0.1)
					coin.Orientation.Y = coin.Orientation.Y + 0.3
				end
			end
		end
	end
end
coin.Touched:Connect(onTouched)

ERROR MSG BELOW
l
l
V

image

try this

local debounceTime = 1
local canCollect = true

local function onTouched(hit)
	if not canCollect then return end

	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		local stats = player:FindFirstChild("leaderstats")
		if stats then
			local coins = stats:FindFirstChild("Coins")
			if coins then
				canCollect = false
				coins.Value = coins.Value + 1

				-- Optional: Add sound or particle effect here
				coin.Transparency = 1
				coin.CanCollide = false

				wait(debounceTime) -- Time before coin respawns

				coin.Transparency = 0
				coin.CanCollide = true
				canCollect = true
				
				--- Changing the coins orientation ---
				while true do
					wait(0.1)
					coin.Orientation +=  Vector3.new(0, .3, 0)
				end
			end
		end
	end
end
coin.Touched:Connect(onTouched)

the coin is still frozen in place unfortunately

yeah, because the spin interval is so small, change it to something higher than .3 like 3

1 Like

ah thank you it works great!! much appreciated

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