I was trying to make it clone the coin that was picked and cloned to the workspace and it didnt work...
--[[ script.Parent.BrickColor = BrickColor.new(colors[math.random(1, #colors)] Scripted by Dreamingrocky/UltraUnitMode. --]] local Coins = game.ServerStorage.Coins local CoinsNames = { "BronzeCoin", "GoldCoin", "SilverCoin", } local Positions = { -154.1, 1.1, 86.9, -170.1, 1.1, 61.9, -132.1, 1.1, 63.9, -144.1, 1.1, 46.9, -172.1, 1.1, 36.9, } while true do for i,v in pairs(Coins.FolderCoins:GetChildren()do wait(0.5) if Coins.Name == CoinsName[math.random(1, #CoinsNames)]then Coins.Position = Vector3.new(Positions[math.random(1, #CoinsNames)]) x = Coins:Clone() x.Parent = game.Workspace end end end end
Your error is how your storing the positions
--[[ script.Parent.BrickColor = BrickColor.new(colors[math.random(1, #colors)] Scripted by Dreamingrocky/UltraUnitMode. --]] local Coins = game.ServerStorage.Coins local CoinsNames = { "BronzeCoin", "GoldCoin", "SilverCoin", } local Positions = { Vector3.new(-154.1, 1.1, 86.9), Vector3.new(-170.1, 1.1, 61.9), Vector3.new(-132.1, 1.1, 63.9), Vector3.new(-144.1, 1.1, 46.9), Vector3.new(-172.1, 1.1, 36.9), } --[[ A new line doesn't actually mean something, whitespaces are ignore in Lua while true do for i,v in pairs(Coins.FolderCoins:GetChildren()do wait(0.5) if Coins.Name == CoinsName[math.random(1, #CoinsNames)]then Coins.Position = Positions[math.random(1, #CoinsNames)] x = Coins:Clone() x.Parent = game.Workspace end end end end
Your problem was that the interpreter thought that you were storing a double type number, meaning a number with a decimal. While in reality you wanted the interpreter to return Vector3 values.
To sum it up
Lua thought this:
Coins.Position = 54.33
While you actually wanted
Coints.Position = Vector3.new(0, 0, 0)
Also, I noticed your code have some syntax errors plus other interpreted errors. Take a look at your code:
--[[ script.Parent.BrickColor = BrickColor.new(colors[math.random(1, #colors)] Scripted by Dreamingrocky/UltraUnitMode. --]] local Coins = game.ServerStorage.Coins local CoinsNames = { "BronzeCoin", "GoldCoin", "SilverCoin", } local Positions = { -154.1, 1.1, 86.9, -170.1, 1.1, 61.9, -132.1, 1.1, 63.9, -144.1, 1.1, 46.9, -172.1, 1.1, 36.9, } while true do for i,v in pairs(Coins.FolderCoins:GetChildren()do wait(0.5) if Coins.Name == CoinsName[math.random(1, #CoinsNames)]then Coins.Position = Vector3.new(Positions[math.random(1, #CoinsNames)]) x = Coins:Clone() x.Parent = game.Workspace end end end end
And take a look at my:
--[[ script.Parent.BrickColor = BrickColor.new(colors[math.random(1, #colors)] Scripted by Dreamingrocky/UltraUnitMode. --]] local Coins = game.ServerStorage.Coins local CoinsNames = { "BronzeCoin", "GoldCoin", "SilverCoin", } local Positions = { Vector3.new(-154.1, 1.1, 86.9), Vector3.new(-170.1, 1.1, 61.9), Vector3.new(-132.1, 1.1, 63.9), Vector3.new(-144.1, 1.1, 46.9), Vector3.new(-172.1, 1.1, 36.9), } while true do for i,v in pairs(Coins.FolderCoins:GetChildren()do if v.Name == CoinsName[math.random(1, #CoinsNames)] then wait(0.5) local coin = v:Clone() coin.Parent = workspace coin.Position = Vector3.new(Positions[math.random(1, #CoinsNames)]) end end end
If this help please vote up and as accepted, if it doesn't let me know and I'll help more. :)
Another error. Change this:
for i,v in pairs(Coins.FolderCoins:GetChildren()do
To:
for i,v in pairs(Coins.FolderCoins:GetChildren()) do