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: Easy script, why doesn't this work?

Previous Thread :: Next Thread 
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 01:39 AM
game.Players.PlayerAdded:connect(function(player)
local found = game.Workspace.FindFirstChild("Shirt")
if found then
game.Workspace.found:Remove()
end
end)

I'm trying to remove the shirt when a player joins, but eh, I think I'm missing something.
Report Abuse
Marolex is not online. Marolex
Joined: 17 Dec 2012
Total Posts: 1785
18 Feb 2014 01:42 AM
you need to remove shirt and shirtgraphic from the character

~TheScrub~
Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 01:56 AM
Okay, but how do I access the character?
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
18 Feb 2014 01:58 AM
player.Character





Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 01:59 AM
Oops, it's :FindFirstChild, not .FindFirstChild.
Report Abuse
Marolex is not online. Marolex
Joined: 17 Dec 2012
Total Posts: 1785
18 Feb 2014 01:59 AM
game.Players.PlayerAdded:connect(function(p)
p.Character
etc

~TheScrub~
Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 02:08 AM
Like this?

game.Players.PlayerAdded:connect(function(player)
local found = game.player.Character:FindFirstChild("Shirt")
if found then
game.player.Character.found:Remove()
end
end)
Report Abuse
Marolex is not online. Marolex
Joined: 17 Dec 2012
Total Posts: 1785
18 Feb 2014 02:12 AM
you need to remove "roblox" from torso and "Shirt Graphic" from character.

~TheScrub~
Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 02:33 AM
Isn't Shirt Graphic for a Tshirt?
Report Abuse
Marolex is not online. Marolex
Joined: 17 Dec 2012
Total Posts: 1785
18 Feb 2014 02:36 AM
Sorry, i thought you where trying to remove the tshirt

so yes, that script you mentioned previously would work.

~TheScrub~
Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 04:47 AM
Okay, thanks for the help.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
18 Feb 2014 06:10 AM
game.Players.PlayerAdded:connect(function(player)
local found = player.Character.Shirt
if found ~= then
found:Destroy()
end
end)


--Try that!
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
18 Feb 2014 06:19 AM
Found an error in my own script;

game.Players.PlayerAdded:connect(function(player)
local found = player.Character:FindFirstChild("Shirt")
if found ~= nil then
found:Destroy()
end
end)


--Try that!
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
18 Feb 2014 06:33 AM
~= is redundant
Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
18 Feb 2014 08:48 AM
Nope, none of these work.
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
18 Feb 2014 01:32 PM
Player added doesn't work in play solo
Report Abuse
oscaroshkosh is not online. oscaroshkosh
Joined: 13 Apr 2012
Total Posts: 331
21 Feb 2014 11:38 AM
I've tried it in online mode too, nothing.
Report Abuse
whyaname98 is not online. whyaname98
Joined: 22 May 2011
Total Posts: 3979
21 Feb 2014 11:41 AM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function()
local found = player.Character:FindFirstChild("Shirt")
if found ~= nil then
found:Destroy()
end)
end
end)

#LogicMakesSense
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
21 Feb 2014 11:44 AM
I think the problem is you are looking for the shirt before it loads. Two possible solutions:

game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
local found = player.Character:FindFirstChild("Shirt")
if found then
found:Destroy()
end
end)

game.Players.PlayerAdded:connect(function(player)
repeat wait() until player.Character
local found = player.Character:FindFirstChild("Shirt")
if found then
found:Destroy()
end
end)
Report Abuse
Kingmouli is not online. Kingmouli
Joined: 28 Sep 2012
Total Posts: 1292
21 Feb 2014 11:51 AM
Idiots everywhere .-. Hint: for loop and class name
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
21 Feb 2014 03:50 PM
@King And now I feel completely stupid.

game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Shirt") then
v:Destroy()
end
end
end)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Feb 2014 04:11 PM
Yeah,but still should use .CharacterAdded so the shirt thingll happen every time,instead of only once
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