malliox12Join Date: 2008-09-17 Post Count: 356 |
im making a script for the guardbots that roblox have that makes u the owner (3 different scripts edits everything to make u the owner)
function CA(guy)
wait(20)
if workspace.GuardBot1.PlayerIdTag.Value == "0" then
workspace.GuardBot1.PlayerIdTag.Value = guy.userId
elseif workspace.GuardBot2.PlayerIdTag.Value == "0" then
workspace.GuardBot2.PlayerIdTag.Value = guy.userId
elseif workspace.GuardBot3.PlayerIdTag.Value == "0" then
workspace.GuardBot3.PlayerIdTag.Value = guy.userId
elseif workspace.GuardBot4.PlayerIdTag.Value == "0" then
workspace.GuardBot4.PlayerIdTag.Value = guy.userId
elseif workspace.GuardBot5.PlayerIdTag.Value == "0" then
workspace.GuardBot5.PlayerIdTag.Value = guy.userId
elseif workspace.GuardBot6.PlayerIdTag.Value == "0" then
workspace.GuardBot6.PlayerIdTag.Value = guy.userId
end
end
game.Players.ChildAdded:connect(CA) |
|
HPtopiaJoin Date: 2011-01-09 Post Count: 369 |
I prefer using if instead of all those elseif's but you need another end to close the function. |
|
walter232Join Date: 2009-06-07 Post Count: 451 |
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
--Code here
end) end) |
|
|
malliox12Join Date: 2008-09-17 Post Count: 356 |
still not working D: |
|
HPtopiaJoin Date: 2011-01-09 Post Count: 369 |
Doesn't he need one for the function, for the if, and for the elseif's? |
|
malliox12Join Date: 2008-09-17 Post Count: 356 |
only for function and if's |
|
|
ArchimatoJoin Date: 2009-07-04 Post Count: 15 |
Workspace needs a capitalized 'W'. |
|
|
In this case that doesnt matter Arch, it will still work. |
|
malliox12Join Date: 2008-09-17 Post Count: 356 |
nope, no output, it seems to run just fine |
|
malliox12Join Date: 2008-09-17 Post Count: 356 |
just noticed sometihng... does the used id thingy need capital "U"? |
|
JonealJoin Date: 2010-01-05 Post Count: 122 |
I have to ideas.
1. Is the value in the guard a Number Value or a string? It has quotes around it but I think the userId property is a number.
2. If your testing this in Solo Test Mode, your userId is 0. |
|
malliox12Join Date: 2008-09-17 Post Count: 356 |
would this work?
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
if Workspace.GuardBot1.PlayerIdTag.Value == 0 then
Workspace.GuardBot1.PlayerIdTag.Value = Player.userId
elseif Workspace.GuardBot2.PlayerIdTag.Value == 0 then
Workspace.GuardBot2.PlayerIdTag.Value = Player.userId
elseif Workspace.GuardBot3.PlayerIdTag.Value == 0 then
Workspace.GuardBot3.PlayerIdTag.Value = Player.userId
elseif Workspace.GuardBot4.PlayerIdTag.Value == 0 then
Workspace.GuardBot4.PlayerIdTag.Value = Player.userId
elseif Workspace.GuardBot5.PlayerIdTag.Value == 0 then
Workspace.GuardBot5.PlayerIdTag.Value = Player.userId
elseif Workspace.GuardBot6.PlayerIdTag.Value == 0 then
Workspace.GuardBot6.PlayerIdTag.Value = Player.userId
end
end) end)
|
|
JonealJoin Date: 2010-01-05 Post Count: 122 |
Possibly. |
|
|
Mal what value thing are you using ? StringValue, IntValue, etc ? |
|
malliox12Join Date: 2008-09-17 Post Count: 356 |
intvalue... does it make any difference then stringvalue? |
|