Trying to make something Spin but it keeps giving me this error.
Code:
local SpinAmount = 0.1
local YellowCoin = game.Workspace.Coins.YellowCoin.Coins:GetChildren()
while wait(0.01) do
YellowCoin.CFrame = YellowCoin.CFrame * CFrame.Angles(0, SpinAmount, 0)
end
local SpinAmount = 0.1
local YellowCoin = game.Workspace.Coins.YellowCoin.Coins:GetChildren()
while wait(0.01) do
for i, v in pairs(YellowCoin) do
v.CFrame = v.CFrame * CFrame.Angles(0, SpinAmount, 0)
end
end
You’re getting a table of the instances contained in the Coins folder, so you need to loop through them and apply the changes to the items not the folder
If it’s a model then set a primary part then spin it using Model:SetPrimaryPartCFrame():
local SpinAmount = 0.1
local YellowCoin = game.Workspace.Coins.YellowCoin.Coins
while wait(0.01) do
YellowCoin:SetPrimaryPartCFrame(YellowCoin.PrimaryPart.CFrame * CFrame.Angles(0, SpinAmount, 0))
end