|
| 24 Nov 2011 11:22 PM |
humanoid = game.Workspace.Humanoid.ClassName redgun = game.Lighting.RedGun
game.Players.PlayerAdded:connect(function(p) if p.TeamColor == BrickColor.new("Bright red") then while wait() do if not p:findFirstChild("Backpack") then wait() else break end end redgun:clone().Parent = p.StarterGear redgun:clone().Parent = p.Backpack end
c = p.Character a = game.Workspace:findFirstChild(c)
function IsAChild(humanoid,a) if humanoid.Parent == a then sg = a:findFirstChild("Shirt graphic") if sg then --if sg exists sg:remove() end s = a:findFirstChild("Shirt") if s then --if s exists s:remove() end p = a:findFirstChild("Pants") if p then --if p exists p:remove() end sg = a:findFirstChild("Hat") if h then --if h exists h:remove() end end end
end)
The first function executes fine, but the second one doesn't work. The output doesn't give any errors. |
|
|
| Report Abuse |
|
|
| |
|
sncplay42
|
  |
| Joined: 27 Nov 2008 |
| Total Posts: 11891 |
|
|
| 25 Nov 2011 10:54 AM |
You need to call it or connect it to an event to run.
function IsAChild(a) sg = a:findFirstChild("Shirt graphic") if sg then --if sg exists sg:remove() end s = a:findFirstChild("Shirt") if s then --if s exists s:remove() end p = a:findFirstChild("Pants") if p then --if p exists p:remove() end sg = a:findFirstChild("Hat") if h then --if h exists h:remove() end end
p.CharacterAdded:connect(function(character) for i, obj in ipairs(character:GetChildren()) do IsAChild(obj) end end) |
|
|
| Report Abuse |
|
|
|
| 25 Nov 2011 10:57 AM |
| Put it's already connected to game.Players.PlayerAdded:connect(function(p) |
|
|
| Report Abuse |
|
|
sncplay42
|
  |
| Joined: 27 Nov 2008 |
| Total Posts: 11891 |
|
| |
|
| |
|
|
| 25 Nov 2011 11:06 AM |
| That errored with an eof expected so I added an end before the end) and now it wants and end) to close the ( in line 41 - p.CharacterAdded:connect(function(character) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
sncplay42
|
  |
| Joined: 27 Nov 2008 |
| Total Posts: 11891 |
|
|
| 25 Nov 2011 01:12 PM |
Did you insert that function back into the script right? Here's the full script:
humanoid = game.Workspace.Humanoid.ClassName redgun = game.Lighting.RedGun
game.Players.PlayerAdded:connect(function(p) if p.TeamColor == BrickColor.new("Bright red") then while wait() do if not p:findFirstChild("Backpack") then wait() else break end end redgun:clone().Parent = p.StarterGear redgun:clone().Parent = p.Backpack end
--the variables here weren't used
function IsAChild(a) sg = a:findFirstChild("Shirt graphic") if sg then --if sg exists sg:remove() end s = a:findFirstChild("Shirt") if s then --if s exists s:remove() end p = a:findFirstChild("Pants") if p then --if p exists p:remove() end sg = a:findFirstChild("Hat") if h then --if h exists h:remove() end end
p.CharacterAdded:connect(function(character) for i, obj in ipairs(character:GetChildren()) do IsAChild(obj) end end)
end) |
|
|
| Report Abuse |
|
|
|
| 25 Nov 2011 02:21 PM |
| That said unexpected character near ')' in the last line so I removed the ), then it said an end was expected at line 48 to close a function so I added the end. It then said it expected a ')' near the end I added so I put it in and we're back to my first problem - the first function runs fine but the second doesn't work. |
|
|
| Report Abuse |
|
|
sncplay42
|
  |
| Joined: 27 Nov 2008 |
| Total Posts: 11891 |
|
|
| 25 Nov 2011 02:22 PM |
| The full script as I posted it worked fine for me =/ |
|
|
| Report Abuse |
|
|
|
| 25 Nov 2011 05:30 PM |
| I tried it again and it's not erroring, but it's still not taking my clothes off. |
|
|
| Report Abuse |
|
|
| |
|
| |
|