yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 16 Feb 2014 11:22 AM |
The last function that launches "uni()" (at the bottom) is not working, what am I doing wrong. :/
-----------------------------------------------------
player = game.Players.LocalPlayer character = player.Character red = game.Lighting.red blue = game.Lighting.blue
function uni() if character:findFirstChild("Shirt") ~= nil then character.Shirt:Remove() end if character:findFirstChild("Pants") ~= nil then character.Pants:Remove() end if player.TeamColor == BrickColor.new("Bright red") then rs = red.Shirt:Clone() rp = red.Pants:Clone() rs.Parent = character rp.Parent = character elseif player.TeamColor == BrickColor.new("Bright blue") then bs = blue.Shirt:Clone() bp = blue.Pants:Clone() bs.Parent = character bp.Parent = character end
end
player.CharacterAdded:connect(function(character) uni() end)
|
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 16 Feb 2014 11:24 AM |
I'm assuming this script is in StarterPack or StarterGui. If I'm right in assuming that, you don't need to use an event - at all.
|
|
|
| Report Abuse |
|
|
SFOH
|
  |
| Joined: 01 Nov 2009 |
| Total Posts: 293 |
|
|
| 16 Feb 2014 11:24 AM |
you forgot to connect character into uni()
therefore, it should be uni(character) |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 16 Feb 2014 11:28 AM |
| @DataStore I started off by doing that but the script doesn't seem to reset on character's death so it just runs once.. |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 16 Feb 2014 11:30 AM |
uni(character) wouldn't work because the function was never defined with any parameters. And plus it's kinda unnecesary since character was already defined at the top... Try this:
player = game.Players.LocalPlayer character = player.Character red = game.Lighting.red blue = game.Lighting.blue function uni() if character:findFirstChild("Shirt") ~= nil then character.Shirt:Remove() end if character:findFirstChild("Pants") ~= nil then character.Pants:Remove() end if player.TeamColor == BrickColor.new("Bright red") then rs = red.Shirt:Clone() rp = red.Pants:Clone() rs.Parent = character rp.Parent = character elseif player.TeamColor == BrickColor.new("Bright blue") then bs = blue.Shirt:Clone() bp = blue.Pants:Clone() bs.Parent = character bp.Parent = character end end player.CharacterAdded:connect(uni) |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 16 Feb 2014 11:34 AM |
| That seemed like a good idea but its not working neither :/ does it have something to do that this is inside StarterGui and it is a local script? |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 11:38 AM |
red = game.Lighting.red blue = game.Lighting.blue
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char)--this will run every time the character respawns for I,v in pairs(char:GetChildren()) do if v:IsA ("Shirt") or v:IsA ("Pants") then v:destroy() end end if plr.TeamColor == BrickColor.new("Bright red") then rs = red.Shirt:clone() rp = red.Pants:clone() rs.Parent = char rp.Parent = char elseif plr.TeamColor == BrickColor.new("Bright blue") then bs = blue.Shirt:clone() bp = blue.Pants:clone() bs.Parent = char bp.Parent = char end end) end) |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 11:39 AM |
ps character = player.Character? you were attempting to define character BEFORE it spawned,anyway,hope I helped:D
-islandmaker2012,here to..eat pizza?..no!save da day!- |
|
|
| Report Abuse |
|
|
|
| 16 Feb 2014 11:39 AM |
| with my script,put It in workspace,and test in server |
|
|
| Report Abuse |
|
|
SFOH
|
  |
| Joined: 01 Nov 2009 |
| Total Posts: 293 |
|
|
| 16 Feb 2014 11:41 AM |
| game.Players.PlayerAdded:connect(function(f) f.CharacterAdded:connect(function(g) uni(g) end)end) |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 16 Feb 2014 11:50 AM |
| @islandmaker2012 I tried adding it into workspace but its still not working for some reason its no even going into the PlayerAdded function (I tried to test using print'') :( |
|
|
| Report Abuse |
|
|
SFOH
|
  |
| Joined: 01 Nov 2009 |
| Total Posts: 293 |
|
|
| 16 Feb 2014 11:56 AM |
HOW ABOUT YOU TRY AND USE MY SCRIPTING ADVICE? HOW ABOUT THAT? |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 16 Feb 2014 12:02 PM |
Its not working :/ But i've recently discovered it DOES go through all the script but for some reason it skips adding the shirt and pants to the player, no idea why. e.e |
|
|
| Report Abuse |
|
|