Hey! I’m making a script which will clone the first person who touches a part in roblox studio.
My script:
local table1 = {}
function addPlayerToTable(player)
local name = player.Parent.Name
table.insert(table1, name)
print(table1[1])
local function nicetest()
local clone = game.Players[table1[0]].Character
clone.Archivable = true
local clone2 = clone:clone()
clone2.Parent = game.Workspace
clone.Archivable = false
local cloned2 = game.ServerStorage.script:Clone()
cloned2.Parent = clone2.Humanoid
cloned2.Enabled = true
end
nicetest()
end
script.Parent.Touched:Connect(addPlayerToTable)
The error I’m getting: Workspace.Part.Script:10: invalid argument #2 (string expected, got nil)
This is a ServerScript and it’s in a part inside workspace.
All help appreciated