|
I tried everything. Using onplayeradded, getplayerfromcharacter, everything. What do i do.. |
|
BanTechJoin Date: 2015-12-31 Post Count: 886 |
for _, player in pairs(game.Players:GetChildren()) do
--do stuff
end |
|
|
I tried this:
for _, player in pairs(game.Players:GetChildren()) do
local a = game.Lighting.LinkedSword:Clone()
a.Parent = player.Backpack
a:MakeJoints()
end
i have no idea what the pairs stuff is and all that, but when i ran the game it didnt even print an error. just nothing happened. |
|
BanTechJoin Date: 2015-12-31 Post Count: 886 |
Hold on, is this script running straight away? If so then why even use a script when you have StarterPack? |
|
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
killer, what is :MakeJoints() supposed to do in that code?
curious
|
|
|
sorry that i didnt respond. i had to shovel snow, and then got picked up by my dad and had to go sledding.
No, the script doesnt run immediately, i just want it to happen when its activated. |
|
|
killer, like bantechs, the script didnt print an error but didnt do anything either. |
|
cgjnmJoin Date: 2011-12-22 Post Count: 2347 |
function Tools()
for i,v in pairs(game.Players:GetPlayers())do
Tool:Clone().Parent = v.Backpack
end
end
--Make sure to call the function with:
Tools()
If you are trying to call it from a separate script, try this:
_G.Tools = function()
for i,v in pairs(game.Players:GetPlayers())do
Tool:Clone().Parent = v.Backpack
end
end
And you can call it from other scripts using:
_G.Tools() |
|
|
Ok. Let me try to explain this in the greatest detail possible
This script,
local Tool = game.Lighting.LinkedSword
function Tools()
for i,v in pairs(game.Players:GetPlayers())do
Tool:Clone().Parent = v.Backpack
end
end
Tools()
Did not work. Didnt print an error but AGAIN... did nothing.
Ok so listen:
-Im using a server script.
-The script is in the Workspace.
-The tool im cloning, LinkedSword, is in the Lighting.
-What i want is when the script is activated, the tool is cloned from the lighting, and placed into the players backpack.
-In all 3 scripts i saw, no errors were printed but nothing happened.
-There will really only be 1 player in a server at a time. Its a single player game, so i figured it didnt matter if i used a get ALL players thing.
If you have any other questions ill try to answer... so what the heck is going on?? |
|
cgjnmJoin Date: 2011-12-22 Post Count: 2347 |
local Tool = game.Lighting:FindFirstChild'LinkedSword'
function Tools()
print'Function called'
for i,v in pairs(game.Players:GetPlayers())do
print'adding tool'
Tool:Clone().Parent = v.Backpack
print'added tool'
end
end
Tools() |
|
|
it stopped at function called. |
|
FrostOverJoin Date: 2013-06-20 Post Count: 299 |
put your tools in serverstorage not lighting you scrubs |
|
cgjnmJoin Date: 2011-12-22 Post Count: 2347 |
Are you actually in the game (test mode) or are you running it? |
|
cgjnmJoin Date: 2011-12-22 Post Count: 2347 |
There actually needs to be players to work.. |
|
|
im using test mode.
im not stupid, lol |
|
cgjnmJoin Date: 2011-12-22 Post Count: 2347 |
Maybe add a wait() after for i,v in pairs do? |
|