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: ROBLOX Is Getting an Error

Previous Thread :: Next Thread 
Splashsky is not online. Splashsky
Joined: 30 Aug 2008
Total Posts: 1102
02 Apr 2014 02:50 PM
I've trying to create a library script for my RPG... the respawn function gives me an issue when I attempt to look for hats.

RPGLib.RespawnMob = function(Replacement, BodyParts)
-- Get rid of pesky things.
BodyParts["FakeHead"].MobGUI:remove()
BodyParts["LeftArm"].DamageScript:remove()
BodyParts["RightArm"].DamageScript:remove()
BodyParts["Head"]:remove()

-- Fade away all body parts, then delete them.
local parts = {} -- Array/table to hold body parts.

-- We're grabbing all the parts in the mob's model.
for _,v in pairs(script.Parent.Parent:GetChildren()) do

if v:IsA("Hat") then -- error occurs here
-- It's a hat check, in case anything is a handle brick.
table.insert(parts, v.Handle)

elseif v:IsA("Part") then
-- For normal parts.
table.insert(parts, v)

end
end

wait(1)

for i = -0.03, 1.04, 0.05 do
-- This will send the blocks through a loop for transparency; makes a fading effect.
for _,v in pairs(parts) do
v.Transparency = i -- Changes each block's transparency!
end

wait(0.1)
end

-- Deleting all body parts for cleanliness.
BodyParts["Torso"]:remove()
BodyParts["LeftArm"]:remove()
BodyParts["LeftLeg"]:remove()
BodyParts["RightArm"]:remove()
BodyParts["RightLeg"]:remove()
BodyParts["FakeHead"]:remove()

-- Wait four seconds
wait(4)

-- Clone the mob.
Enemy = Replacement:clone()

-- Let's set the mob back in the world!
Enemy.Parent = script.Parent.Parent.Parent

-- Let's make it's joints.
Enemy:makeJoints()
end
Report Abuse
Splashsky is not online. Splashsky
Joined: 30 Aug 2008
Total Posts: 1102
02 Apr 2014 03:03 PM
Is it an issue with the IsA() function... or the loop for getting children?
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