Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Roblox table script not working?

No error I just started using tables BTW

Guns = {"AN-94", "DSR50", "Executioner", "FiveSeven", "KAP40", "MTAR", "RM870", "RocektLauncher", "SkorpoinEVO"}
i = math.random(1, #Guns)
F = Guns[i]

if F.Value == "AN-94" then x = game.ServerStorage:FindFirstChild("AN-94") x:clone() x.Parent = game.workspace

end

1 comment

0

Try "if F.Value == 1 then"

1 answer


Problems

You need to check if it's equal to 1, not check it's name. Say you are using this table;

MyTable = {"Chicken", 10, true}

1 would be Chicken, 2 would be 10, and 3 would be true.


Fixes

Use if F == "1", rather than what you had before.

You can use x = game.ServerStorage:FindFirstChild("AN-94"):Clone(), rather than adding a new line to clone it.

You can also use x.Parent = workspace, rather than using game.Workspace.


Script

Guns = {"AN-94", "DSR50", "Executioner", "FiveSeven", "KAP40", "MTAR", "RM870", "RocektLauncher", "SkorpoinEVO"}

i = math.random(1, #Guns)
F = Guns[i]

if F.Value == "1" then
	x = game.ServerStorage:FindFirstChild("AN-94"):Clone()
	x.Parent = workspace
end

This discussion is preserved as it was. New answers, comments, and votes are closed.