Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
superior
|
  |
| Joined: 13 Apr 2008 |
| Total Posts: 1662 |
|
|
| 21 Aug 2011 03:29 AM |
One more post before I go to bed. xD
plyr = player local a = player:children() for x = 1, #plyr do if plyr[x].ClassName == "forcefield" then plyr[x]:Remove() end end
Something like this. If there are more than one forcefield, you have to use the "for" statement. :findFirstChild("") finds the first child of the object. |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
superior
|
  |
| Joined: 13 Apr 2008 |
| Total Posts: 1662 |
|
|
| 21 Aug 2011 03:42 AM |
| That line that you mentioned. Going to bed, I'll help in the morning. |
|
|
| Report Abuse |
|
|
gombob
|
  |
| Joined: 01 May 2008 |
| Total Posts: 5215 |
|
|
| 21 Aug 2011 04:54 AM |
local ButtonCon = script.Parent local Frame = script.Parent.Parent local Text = script.Parent.Parent.TextLabel local AFKbutton = script.Parent.Parent.Parent.TextButton local Torso = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
function onClick() for i=1, 10 do ButtonCon.BackgroundTransparency = i/10 ButtonCon.TextTransparency = i/10 wait() end for i=1,10 do Text.TextTransparency = i/10 wait() end for i=1,10 do Frame.BackgroundTransparency = i/10 wait() end AFKbutton.Visible = true script.Parent.Parent.Runner.Disabled = true Frame.Visible = false while(Torso.Parent:FindFirstChild("ForceField", true)) do Torso.Parent:FindFirstChild("ForceField", true).Parent = nil end Torso.Parent.Humanoid.WalkSpeed = 16 end
--[[ It will only remove ForceFields with the name "ForceField" e.g. If a ForceField has the name "FField", it won't be removed
I tested it and it worked :p ]]
|
|
|
| Report Abuse |
|
|
|
| 21 Aug 2011 05:05 AM |
local ButtonCon = script.Parent local Frame = script.Parent.Parent local Text = script.Parent.Parent.TextLabel local AFKbutton = script.Parent.Parent.Parent.TextButton local Torso = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
function onClick() for i=1, 10 do ButtonCon.BackgroundTransparency = i/10 ButtonCon.TextTransparency = i/10 wait() end for i=1,10 do Text.TextTransparency = i/10 wait() end for i=1,10 do Frame.BackgroundTransparency = i/10 wait() end
AFKbutton.Visible = true script.Parent.Parent.Runner.Disabled = true Frame.Visible = false c = Torso.Parent:GetChildren() for i = 1, #c do if c[i].className == "ForceField" then c[i]:remove() end end Torso.Parent.Humanoid.WalkSpeed = 16 end
--[[ That will remove every forcefield no matter what it's called. Unless I made a spelling mistake ]]
|
|
|
| Report Abuse |
|
|
gombob
|
  |
| Joined: 01 May 2008 |
| Total Posts: 5215 |
|
|
| 21 Aug 2011 05:10 AM |
But it won't remove ForceFields inside the Head or Torso because it isn't recursive...
This one will remove all ForceFields regardless which name they have:
local ButtonCon = script.Parent local Frame = script.Parent.Parent local Text = script.Parent.Parent.TextLabel local AFKbutton = script.Parent.Parent.Parent.TextButton local Torso = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
local function DelFF(par) local kids = par:children() for i=1, #kids do if kids[i]:IsA("ForceField") then kids[i].Parent = nil else DelFF(kids[i]) end end end
function onClick() for i=1, 10 do ButtonCon.BackgroundTransparency = i/10 ButtonCon.TextTransparency = i/10 wait() end for i=1,10 do Text.TextTransparency = i/10 wait() end for i=1,10 do Frame.BackgroundTransparency = i/10 wait() end
AFKbutton.Visible = true script.Parent.Parent.Runner.Disabled = true Frame.Visible = false DelFF(Torso.Parent) Torso.Parent.Humanoid.WalkSpeed = 16 end |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2011 05:22 AM |
Unneccecary functions aren't needed. What you need here is a simple for loop.
for INDEX,VALUE in pairs(INSTANCE:GetChildren()) do if VALUE:IsA("ForceField") then VALUE:remove() end end |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
gombob
|
  |
| Joined: 01 May 2008 |
| Total Posts: 5215 |
|
|
| 21 Aug 2011 07:32 AM |
| @UtterMost: That function was needed because it keeps calling itself until all the ForceFields are deleted. It's the only way to delete all possible ForceFields |
|
|
| Report Abuse |
|
|