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: VIP Shirt Help????

Previous Thread :: Next Thread 
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
01 Mar 2014 09:27 AM
How would I go about checking if the player is wearing a certain shirt when they join? The problem I'm currently having is that the script fails to check if the player's shirt loaded, which I thought was the same as waiting for their character.

I have a player.CharacterAdded:wait() ONLY if their character does not exist, and an if and then check for their shirt and t-shirt, and a for loop looping through their character just in case along with the if and then, and neither is detecting the shirt for some reason.

How can I wait until their character's shirt has loaded. I can't do repeat wait() until player.Character:findFirstChild("Shirt") because player's may not be wearing a shirt, so it would repeat forever and not continue the code.

Please help! Thanks!
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
01 Mar 2014 10:26 AM
TL;DR: How can I wait until a player's shirt has loaded when they join the game? I can't do repeat wait() until player.Character:findFirstChild("Shirt") because player's may not be wearing a shirt, so it would repeat forever and not continue the code.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
01 Mar 2014 11:44 AM
Pl3@s3 h@1p m3!!!
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
01 Mar 2014 03:26 PM
Bump please help someone!!!
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
02 Mar 2014 12:25 PM
Anyone???
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
02 Mar 2014 01:17 PM
Last bump before repost COME ON GUYS!!!
Report Abuse
MightyWanderer is not online. MightyWanderer
Joined: 17 Jan 2011
Total Posts: 1110
02 Mar 2014 01:27 PM
Is it a T-shirt or a shirt it's trying to detect? There is no real object for t-shirts, it just places a decal on the player's torso.

Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
03 Mar 2014 04:17 PM
There actually is, it's calle ShirtGraphic.

I actually have both a Shirt and T-Shirt, so both :P.

I want to award different points based on if they are wearing the shirt or t-shirt.
Report Abuse
MightyWanderer is not online. MightyWanderer
Joined: 17 Jan 2011
Total Posts: 1110
03 Mar 2014 06:54 PM
I know about ShirtGraphics, but when a player actually wears a t-shirt into the game it just sticks a decal on their torso. I don't know why, but I was trying to figure out why my script wasn't detecting t-shirts and I discovered that's why.

Are you using IsA to look for the shirt/t-shirt?

Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
04 Mar 2014 10:43 PM
Yes I am doing exactly that lol.

So in Studio mode when you test your character, it shows a ShirtGraphic, but online it is a Decal on Torso? Weird.

Im having trouble with Shirts too :P.
Report Abuse
MightyWanderer is not online. MightyWanderer
Joined: 17 Jan 2011
Total Posts: 1110
05 Mar 2014 07:40 PM
Hm, maybe they updated it so it does put a ShirtGraphic on you. You can check by opening a test server and player - F7 to start a server then Alt + F7 to start a player.

Are you detecting when the player joins or spawns?

Report Abuse
MightyWanderer is not online. MightyWanderer
Joined: 17 Jan 2011
Total Posts: 1110
05 Mar 2014 07:43 PM
Whoops, just remembered what you said in your first post. Why don't you try a simple script, then add on to it? I'm not quite sure what your problem is exactly.

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
print(player.Name.." spawned")
for i,v in pairs(char:GetChildren()) do
if v:IsA("Shirt") then
print(player.Name.." has a shirt!")
elseif v:IsA("ShirtGraphic") then
print(player.NAme.." has a t-shirt!")
end
end
end)
end)

Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
05 Mar 2014 07:47 PM
elseif v:IsA("ShirtGraphic") and v.Texture = "" then--just add that bit
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
06 Mar 2014 03:49 PM
I have practically that exact code, but the problem seems to be that it checks if the shirt is the right texture before the shirt loads, but after the player's character loads. Not quite sure about this, but I added elses to print stuff if it has the wrong texture and it does that in server mode in Studio even if Im wearing the right shirt/t-shirt. It's very weird.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
07 Mar 2014 12:48 PM
BUMP
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
07 Mar 2014 05:00 PM
h@lp pl0x
Report Abuse
PuNiShEr5665 is not online. PuNiShEr5665
Joined: 12 Aug 2009
Total Posts: 33713
07 Mar 2014 05:25 PM
This should be the answer to your question

http://wiki.roblox.com/index.php/API:Instance/WaitForChild
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
07 Mar 2014 05:29 PM
I know about that. I could wait for the shirt. However the issue with that is that it's possible that they aren't wearing any shirt, which would make the code wait forever. Is there a way around this?
Report Abuse
GRAGGER2001 is not online. GRAGGER2001
Joined: 05 Apr 2009
Total Posts: 2043
07 Mar 2014 05:34 PM
coroutine.resume(coroutine.create(function()
player:WaitForChild('Shirt' or 'ShirtGraphic')
--Code that gives benefits to player if wearing the shirt needed.
end))

That will allow it to wait for the shirt but run the rest of the script while its waiting.
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
07 Mar 2014 05:53 PM
OMG THANK YOU I know coroutines but didn't realize they would be useful I willl try it and see if it works!!!
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
14 Mar 2014 12:56 PM
Still didn't work :(. Didn't even print anything (so the coroutine seems to not be running).
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
15 Mar 2014 04:20 PM
I fixed it and now it works fine except for 1 very minor problem:

If I do the following:

:WaitForChild("Shirt" or "Shirt Graphic")

It waits for the shirt, and not the shirt graphic every time. If I flip them it does the opposite. I want it to wait until there is a shirt or a shirt graphic, but that's not how Lua's or operator works :(. Help!
Report Abuse
MightyWanderer is not online. MightyWanderer
Joined: 17 Jan 2011
Total Posts: 1110
16 Mar 2014 02:44 PM
Have two different :WaitForChild() statements: :WaitForChild("Shirt") :WaitForChild("ShirtGraphic").

Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
17 Mar 2014 01:53 PM
Then if the player is wearing the ShirtGraphic it will wait forever since the :WaitForChild("Shirt") will never be true.
Report Abuse
MightyWanderer is not online. MightyWanderer
Joined: 17 Jan 2011
Total Posts: 1110
19 Mar 2014 02:11 PM
That's why I'd suggest using a for loop on the player (for i,v in pairs(player:GetChildren())), then "if v:IsA("ShirtGraphic") or v:IsA("Shirt") then do stuff".

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