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
|
  |
| 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
|
  |
| Joined: 25 Dec 2012 |
| Total Posts: 305 |
|
| |
|
mulJR
|
  |
| Joined: 25 Dec 2012 |
| Total Posts: 305 |
|
| |
|
mulJR
|
  |
| Joined: 25 Dec 2012 |
| Total Posts: 305 |
|
| |
|
mulJR
|
  |
| Joined: 25 Dec 2012 |
| Total Posts: 305 |
|
| |
|
mulJR
|
  |
| Joined: 25 Dec 2012 |
| Total Posts: 305 |
|
| |
|
mulJR
|
  |
| Joined: 25 Dec 2012 |
| Total Posts: 305 |
|
| |
|
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
|
  |
| 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 |
|
|