generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Shirt/Pants when entering game?

Previous Thread :: Next Thread 
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 09:48 AM
Well, to be honest, I don't what is wrong with this script...It works in Play Solo and when I "Start Server" and "Start Player," but it doesn't work when I actually go on a public server.



shirtid = "http://www.roblox.com/asset/?id=13343842"
pantsid = "http://www.roblox.com/asset/?id=9735893"

function pe(np)
function ca(p)
wait(3)
if p:findFirstChild("Shirt") then
p.Shirt.ShirtTemplate = shirtid
elseif p:findFirstChild("Shirt") == nil then
shirta = Instance.new("Shirt")
shirta.Parent = p
shirta.ShirtTemplate = shirtid
end

if p:findFirstChild("Pants") then
p.Pants.PantsTemplate = pantsid
elseif p:findFirstChild("Pants") == nil then
pantsa = Instance.new("Pants")
pantsa.Parent = p
pantsa.PantsTemplate = pantsid
end

end
np.CharacterAdded:connect(ca)
end
game.Players.PlayerAdded:connect(pe)




Any help please? Thanks!
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 09:53 AM
Budumparoz
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
06 Apr 2012 09:56 AM
shirtid = "http://www.roblox.com/asset/?id=13343842"
pantsid = "http://www.roblox.com/asset/?id=9735893"

function pe(np)
local function ca(p)
wait(3)
if p:findFirstChild("Shirt") then
p.Shirt.ShirtTemplate = shirtid
elseif p:findFirstChild("Shirt") == nil then
shirta = Instance.new("Shirt")
shirta.Parent = p
shirta.ShirtTemplate = shirtid
end

if p:findFirstChild("Pants") then
p.Pants.PantsTemplate = pantsid
elseif p:findFirstChild("Pants") == nil then
pantsa = Instance.new("Pants")
pantsa.Parent = p
pantsa.PantsTemplate = pantsid
end

end
np.CharacterAdded:connect(function() ca(np))
ca(np)
end
game.Players.PlayerAdded:connect(pe)
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
06 Apr 2012 09:58 AM
Oops!

shirtid = "http://www.roblox.com/asset/?id=13343842"
pantsid = "http://www.roblox.com/asset/?id=9735893"

function pe(np)
local function ca(p)
wait(3)
if p:findFirstChild("Shirt") then
p.Shirt.ShirtTemplate = shirtid
elseif p:findFirstChild("Shirt") == nil then
shirta = Instance.new("Shirt")
shirta.Parent = p
shirta.ShirtTemplate = shirtid
end

if p:findFirstChild("Pants") then
p.Pants.PantsTemplate = pantsid
elseif p:findFirstChild("Pants") == nil then
pantsa = Instance.new("Pants")
pantsa.Parent = p
pantsa.PantsTemplate = pantsid
end

end
np.CharacterAdded:connect(function() ca(np) end)
ca(np)
end
game.Players.PlayerAdded:connect(pe)
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
06 Apr 2012 09:58 AM
Oops! once more

shirtid = "http://www.roblox.com/asset/?id=13343842"
pantsid = "http://www.roblox.com/asset/?id=9735893"

function pe(np)
local function ca(p)
wait(3)
if p:findFirstChild("Shirt") then
p.Shirt.ShirtTemplate = shirtid
elseif p:findFirstChild("Shirt") == nil then
shirta = Instance.new("Shirt")
shirta.Parent = p
shirta.ShirtTemplate = shirtid
end

if p:findFirstChild("Pants") then
p.Pants.PantsTemplate = pantsid
elseif p:findFirstChild("Pants") == nil then
pantsa = Instance.new("Pants")
pantsa.Parent = p
pantsa.PantsTemplate = pantsid
end

end
np.CharacterAdded:connect(function() ca(np.Character) end)
end
game.Players.PlayerAdded:connect(pe)
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 09:59 AM
What, might I ask, did you change? I'm just curious.
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 09:59 AM
Oh I see... do I need it in a LocalScript?
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
06 Apr 2012 10:00 AM
Made ca a local function and changed np.CharacterAdded:connect(ca) to np.CharacterAdded:connect(function() ca(np.Character) end)
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
06 Apr 2012 10:00 AM
No, a normal script.
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 10:02 AM
It doesn't work still D:
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
06 Apr 2012 10:07 AM
Put this in 'StarterGui'.

while script.Parent.Parent.Character == nil do wait(0.1) end
wait(3)
local char = script.Parent.Parent.Character
local pants = char:findFirstChild("Pants")
local shirt = char:findFirstChild("Shirt")
if not pants then pants = Instance.new("Pants", char) end
if not shirt then shirt = Instance.new("Shirt", char) end
pants.PantsTemplate = "http://www.roblox.com/asset/?id=9735893"
shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=13343842"
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 10:12 AM
It works in Play Solo and Local Server but not in a public one... Ah well I'll just leave this script. Thanks anyways :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image