Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isnt this script working?

Asked by 9 years ago

I wanted to make the script choose a random coin from the table and paste it to the workspace but it didnt work...I know I did something wrong, but it dont get it still..

local Coins = game.ServerStorage.Coins
local CoinsNames = {
"BronzeCoin",
"GoldCoin",
"SilverCoin",
}




while true do
for i,v in pairs(Coins.FolderCoins:GetChildren())do
if v.Name == CoinsNames[math.random(1, #CoinsNames)] then
wait(0.5)
local coin = v:Clone()
coin.Parent = Workspace
end
end
end

1
Is this in a LocalScript or a Script? Discern 1007 — 9y
1
It works, I just tested it myself. It will not work if it is a localscript. Local scripts do not have access to server storage. TopDev 0 — 9y
1
Use a script, and you should be good to go. TopDev 0 — 9y
0
It doesnt work for me...And its not a local script UltraUnitMode 419 — 9y
View all comments (7 more)
1
Are you getting any errors in output? TopDev 0 — 9y
0
Nope... UltraUnitMode 419 — 9y
1
Really odd, since I tested it myself and it worked perfectly. Can you double check your directory's? Make sure that you didn't misspell anything. You should have ServerStorage > Coins > FolderCoins > (all the coins here) TopDev 0 — 9y
0
16:24:19.967 - FolderCoins is not a valid member of Folder 16:24:19.968 - Script 'Workspace.CoinScriptv0.1', Line 11 UltraUnitMode 419 — 9y
1
Try to delete "FolderCoins" from line 11 so it looks like for i,v in pairs(Coins:GetChildren())do TopDev 0 — 9y
0
It works, thanks!!! UltraUnitMode 419 — 9y
0
This wont always work though because occasionally the values won't match and it wont paste one in when you want it to. dyler3 1510 — 9y

Answer this question