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 » Scripters
Home Search
 

Re: Small problem

Previous Thread :: Next Thread 
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:03 PM
I want this morph to remove shirt and pants and replace it with pants. Here is the script,



local db = false;

script.Parent.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if hit.Parent:FindFirstChild("Pants") then
hit.Parent.Pants:Destroy()
hit.Parent.Shirt:Destroy()
end
local pants = Instance.new("Pants", hit.Parent)
pants.Name = "Pants"
pants.PantsTemplate = "http://www.roblox.com/asset/?id=40465821"
end
wait(.5)
db = false
end
end)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
18 Jan 2015 01:05 PM
local db = false;

script.Parent.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
hit.Parent.Shirt:Destroy()
hit.Parent.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=40465821"
end
wait(.5);db = false
end
end)
Report Abuse
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:09 PM
Doesn't work
Report Abuse
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:13 PM
b1
Report Abuse
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:21 PM
b2
Report Abuse
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:26 PM
b3
Report Abuse
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:30 PM
b4
Report Abuse
mulJR is not online. mulJR
Joined: 25 Dec 2012
Total Posts: 305
18 Jan 2015 01:34 PM
b5
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
18 Jan 2015 01:35 PM
local db = false

script.Parent.Touched:connect(function(hit)
if db == false then
db = true
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local pants
if hit.Parent:FindFirstChild("Pants") ~= nil then
pants = hit.Parent.Pants
hit.Parent.Shirt:Destroy() --will break if shirt doesn't exist, don't know if you accounted for that or not
else
pants = Instance.new("Pants", hit.Parent)
end
pants.PantsTemplate = "http://www.roblox.com/asset/?id=40465821"
end
wait(0.5)
db = false
end
end)

That probably didn't fix whatever problem you were having. You'll need to include an output for further help.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
18 Jan 2015 01:37 PM
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if db == false then
db = true
local pants
if hit.Parent:FindFirstChild("Pants") ~= nil then
pants = hit.Parent.Pants
hit.Parent.Shirt:Destroy() --will break if shirt doesn't exist, don't know if you accounted for that or not
else
pants = Instance.new("Pants", hit.Parent)
end
pants.PantsTemplate = "http://www.roblox.com/asset/?id=40465821"
wait(0.5)
db = false
end
end
end)

Debounce should actually only be used when a humanoid is found.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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