I have it set-up in ReplicatedStorage with a folder called "game" and 2 parts inside. Inside of the workspace i have a part called "Base" and inside of it is a ClickDetector and this script. Why doesnt it work? Please help
local replicatedStorage = game:GetService("ReplicatedStorage")
local gamez = replicatedStorage:WaitForChild("game")
function Clicked()
local pl = gamez:GetChildren()
local selectedIndex = math.random(1,#gamez)
local gmae = pl[selectedIndex]:Clone()
gmae.Parent = game.Workspace
gmae.Name = "Choosen"
return pl[selectedIndex].Name
end
script.Parent.ClickDetector.MouseClick:connect(Clicked)
Here is the error
Workspace.Base.Script:6: attempt to get length of upvalue 'gamez' (a userdata value)
