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: Clothing based script

Previous Thread :: Next Thread 
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
04 Jan 2013 06:27 PM
Recently attempted to make a script that removed a characters old clothes, and replaced them with new ones, however when I try to remove them, in test mode, nothing happens, no errors, and no output from the print commands I put in the script, help please?


game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
wait(1)
print("Hi")
shirt = character:FindFirstChild("Shirt")
if (shirt ~= nil) then
shirt:remove()
end
Print("1")
pants = character:FindFirstChild("Pants")
if (pants ~= nil) then
pants:remove()
end
Print("2")
tshirt = character:FindFirstChild("Shirt Graphic")
if (tshirt ~= nil) then
tshirt:remove()
end
Print("3")

end

Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
04 Jan 2013 06:34 PM
Game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
repeat wait() until character:findFirstChild("Pants")
print("Ready")
wait(1)
shirt = character:findFirstChild("Shirt")
if shirt ~= nil then
shirt:Destroy()
end
priint("Shirt removed")
pants = character:findFirstChild("Pants")
if pants ~= nil then
pants:Destroy()
end
print("Pants removed")
roblox = character.Torso:findFirstChild("roblox")
if roblox ~= nil then
roblox:Destroy()
end
tshirt = character:findFirstChild("Shirt Graphic")
if tshirt ~= nil then
tshirt:Destroy()
end
print("T-Shirt destroyed")
end)
end)

Not sure if it works, just run it and tell me the output.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
04 Jan 2013 06:45 PM
Thanks, It works.
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
04 Jan 2013 06:47 PM
priint("Shirt removed")
Typo
print("Shirt removed")
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
05 Jan 2013 07:47 AM
Tried adding a new part to make a new set of clothes, however, it prints the "asdf" and "fdsa" parts, but when I check in the explorer under the testing character, no new clothes appear, and gives no error.

    Game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
    repeat wait() until character:findFirstChild("Pants")
    print("Ready")
    wait(1)
    shirt = character:findFirstChild("Shirt")
    if shirt ~= nil then
    shirt:Destroy()
    end
    print("Shirt removed")
    pants = character:findFirstChild("Pants")
    if pants ~= nil then
    pants:Destroy()
    end
    print("Pants removed")
    roblox = character.Torso:findFirstChild("roblox")
    if roblox ~= nil then
    roblox:Destroy()
    end
    tshirt = character:findFirstChild("Shirt Graphic")
    if tshirt ~= nil then
    tshirt:Destroy()
    end
    print("T-Shirt destroyed")
            NewTShirt = Instance.new("ShirtGraphic")
            NewPants = Instance.new("Pants")
            NewShirt = Instance.new("Shirt")
    print("fdsa")
            NewTShirt.Parent = _G["Character"]
            NewPants.Parent = _G["Character"]
            NewShirt.Parent = _G["Character"]
            --NewPants.PantsTemplate = "http://www.roblox.com/asset/?id=78845949"
    print("asdf")
    end)
    end)
Any help is appreciated.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
05 Jan 2013 07:48 AM
Almost forgot to mention, did set up the _G variables in a different script.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
05 Jan 2013 09:03 AM
Bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
05 Jan 2013 10:25 AM
Bump of impatience.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
05 Jan 2013 01:06 PM
Bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
05 Jan 2013 03:36 PM
Impatient bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 07:07 AM
Bump of wondering why no one has responded.
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
06 Jan 2013 07:17 AM
what exactly do you need?
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 07:22 AM
Tried adding a new part to make a new set of clothes, however, it prints the "asdf" and "fdsa" parts, but when I check in the explorer under the testing character, no new clothes appear, and gives no error.

    Game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
    repeat wait() until character:findFirstChild("Pants")
    print("Ready")
    wait(1)
    shirt = character:findFirstChild("Shirt")
    if shirt ~= nil then
    shirt:Destroy()
    end
    print("Shirt removed")
    pants = character:findFirstChild("Pants")
    if pants ~= nil then
    pants:Destroy()
    end
    print("Pants removed")
    roblox = character.Torso:findFirstChild("roblox")
    if roblox ~= nil then
    roblox:Destroy()
    end
    tshirt = character:findFirstChild("Shirt Graphic")
    if tshirt ~= nil then
    tshirt:Destroy()
    end
    print("T-Shirt destroyed")
            NewTShirt = Instance.new("ShirtGraphic")
            NewPants = Instance.new("Pants")
            NewShirt = Instance.new("Shirt")
    print("fdsa")
            NewTShirt.Parent = _G["Character"]
            NewPants.Parent = _G["Character"]
            NewShirt.Parent = _G["Character"]
            --NewPants.PantsTemplate = "http://www.roblox.com/asset/?id=78845949"
    print("asdf")
    end)
    end)
Any Idea how to fix it?
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 01:13 PM
Another bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 07:13 PM
Bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 07:53 PM
My patiance has ended, time for faster bumps.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 08:17 PM
Bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
06 Jan 2013 08:53 PM
Asdf bump.
Report Abuse
HD188753 is not online. HD188753
Joined: 13 Jun 2012
Total Posts: 5021
07 Jan 2013 06:10 AM
Another bump.
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