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: Uniform Script

Previous Thread :: Next Thread 
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 09:15 AM
I want a script that automatically gives you a certain shirt (the shirt in the second if statement) if you are not wearing one of the allowed shirts (the shirts in the first if statement). Can you make me one?

Do I have to add onPlayerAdded? If so how?


Here's what I have so far:


while true do
for _,v in pairs(Workspace:GetChildren()) do
if v:findFirstChild("Shirt") ~= nil then
if v.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=122953212" or v.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=139728805" or v.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=73800548" or v.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=93903178" then
v.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=122953212"
end
end
end
wait()
end
Report Abuse
ChaosEspeon is not online. ChaosEspeon
Joined: 02 Jan 2009
Total Posts: 4578
02 Jan 2014 09:40 AM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Shirt")
if character.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=122953212" and character.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=139728805" and character.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=73800548" and character.Shirt.ShirtTemplate ~= "http://www.roblox.com/asset/?id=93903178" then
character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=122953212"
end
end)
end)



That should work.
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 09:55 AM
It didn't.
Report Abuse
ChaosEspeon is not online. ChaosEspeon
Joined: 02 Jan 2009
Total Posts: 4578
02 Jan 2014 10:01 AM
Well what happened when you tried running it?

Any output?
Did it run, but didn't have the same result you wanted?
Report Abuse
BEART12 is not online. BEART12
Joined: 22 Oct 2008
Total Posts: 3190
02 Jan 2014 10:16 AM
.PlayerAdded dosent work in solo test, insted do "Start server"> "StartPlayer"
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 05:31 PM
Heres the output:

18:30:44.745 - DataModel Loading http://www.roblox.com/asset/?id=136310534
18:30:44.745 - https://api.roblox.com/auth/negotiate?ticket=76eb0e0ebedc40b897d55e3d189733d1: err=0x193 (403)
18:30:58.968 - httpGet http://www.roblox.com/Asset/?id=100808216&serverplaceid=0 failed. Trying again. Error: http://www.roblox.com/Asset/?id=100808216&serverplaceid=0: err=0x193 (403). Elapsed time: 0.140697
18:30:59.033 - Content failed for http://www.roblox.com/Asset/?id=100808216&serverplaceid=0 because http://www.roblox.com/Asset/?id=100808216&serverplaceid=0: err=0x193 (403)
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 06:01 PM
Bump
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 07:08 PM
I will bump this every day and night till someone answers my question!!!!
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 07:57 PM
Just keep bumping.
Report Abuse
WillScriptForFood is not online. WillScriptForFood
Joined: 03 Aug 2013
Total Posts: 701
02 Jan 2014 08:01 PM
local shirtIds = {
['73800548'] = true;
['93903178'] = true;
['122953212'] = true;
['139728805'] = true;
}

game:GetService('Players').PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
if (not shirtIds[c.Shirt.ShirtTemplate:match('%d+')]) then
v.Shirt.ShirtTemplate = 'http://www.roblox.com/asset/?id=122953212'
end end) end)
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Jan 2014 08:37 PM
Didn't work.
Report Abuse
WillScriptForFood is not online. WillScriptForFood
Joined: 03 Aug 2013
Total Posts: 701
02 Jan 2014 08:39 PM
M bad, forgot to change something.


local shirtIds = {
['73800548'] = true;
['93903178'] = true;
['122953212'] = true;
['139728805'] = true;
}

game:GetService('Players').PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
if (not shirtIds[c.Shirt.ShirtTemplate:match('%d+')]) then
p.Shirt.ShirtTemplate = 'http://www.roblox.com/asset/?id=122953212'
end end) end)
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