|
line 11, clone is a nil value?
wot?
toolnames = {"hopp1","hopp2","hopp3"}
lighting = game.Lighting
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(1)
for i=1, #toolnames do
for _,v in pairs(lighting:GetChildren()) do
randomchosen = toolnames[math.random(1,#toolnames)]
wait(0.1)
local clone = randomchosen:Clone()
clone.Parent = player.Backpack
end
end
end)
end) |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
I'm pretty sure you just cloned text. |
|
|
have to be object instances.. not strings. |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
After: tool randomtool defined value
rndtool = game.Lighting:FindFirstChild(randomchosen)
local clone = rndtool:clone() |
|
|
thx, i fixed it.. but it gives me all 3 kinds & it gives me like 10 of them??
i only want one.
toolnames = {game.Lighting.hopp1,game.Lighting.hopp2,game.Lighting.hopp3}
lighting = game.Lighting
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(1)
for i=0, #toolnames do
for _,v in pairs(lighting:GetChildren()) do
randomchosen = toolnames[math.random(1,#toolnames)]
wait(0.1)
local clone = randomchosen:Clone()
clone.Parent = player.Backpack
end
end
end)
end) |
|
|
@Hunt, thanks that works, but still the same problem as before
gives a ton :c
toolnames = {"hopp1","hopp2","hopp3"}
lighting = game.Lighting
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(1)
for i=0, #toolnames do
for _,v in pairs(lighting:GetChildren()) do
randomchosen = toolnames[math.random(1,#toolnames)]
rndtool = game.Lighting:FindFirstChild(randomchosen)
wait(0.1)
local clone = rndtool:Clone()
clone.Parent = player.Backpack
end
end
end)
end) |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
If you look closely, you put the cloning into backpack in the same scope as the for loop, effectively cloning the amount of tools in lighting (but randomly picked) into your backpack... |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
--try this
toolnames = {"hopp1","hopp2","hopp3"}
lighting = game.Lighting
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(1)
randomchosen = toolnames[math.random(1,#toolnames)]
rndtool = game.Lighting:FindFirstChild(randomchosen)
wait(0.1)
local clone = rndtool:Clone()
clone.Parent = player.Backpack
end)
end)
|
|
|
@Hunt
thanks it works :D
toolnames = {"hopp1","hopp2","hopp3"}
lighting = game.Lighting
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(1)
for i=0, #toolnames do
for _,v in pairs(lighting:GetChildren()) do
randomchosen = toolnames[math.random(1,#toolnames)]
rndtool = game.Lighting:FindFirstChild(randomchosen)
wait(0.1)
end
end
local clone = rndtool:Clone()
clone.Parent = player.Backpack
end)
end) |
|