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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: What's the problem with this, and how can I fix it?

Previous Thread :: Next Thread 
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:11 PM
Hey guys. I am in the developing of a Zombie, and it has a script called Blood, which when the Zombie dies, it perfectly makes blood without any errors. Now, I am trying to make this script where it realistically removes the blood, and in a minute removes the body. This script's parent is the Blood script which the Blood script's parent is the model, containing the parts of the Zombie, etc. Here's the Blood script, which is working:

function CreateBlood()

local Blood = Instance.new("Part")
Blood.formFactor = "Plate"
Blood.Size = Vector3.new(1,0.4,1)
Blood.Name = "Blood"
Blood.Reflectance = 0.2
Blood.Transparency = 0.2
Blood.BrickColor = BrickColor.new("Bright green")
Blood.Locked = true
Blood.BackSurface = "Glue"
Blood.BottomSurface = "Glue"
Blood.FrontSurface = "Glue"
Blood.LeftSurface = "Glue"
Blood.RightSurface = "Glue"
Blood.TopSurface = "Glue"

local CC = math.random(1,2)

if CC == 1 then

Blood.CanCollide = true

elseif CC == 2 then

Blood.CanCollide = false

end

Blood.Position = script.Parent.Torso.Position
Blood.Parent = script.Parent

end

zombie = script.Parent.Zombie
lhh = zombie.Health

while true do

if zombie.Health < lhh then

howmuch = math.random(7,20)
lhh = zombie.Health

for i = 1 , howmuch do

CreateBlood()

end

end

wait(0.1)

end

Now here is the script that is supposed to realistically remove the blood, and eventually the body, but doesn't work:

repeat wait(0.01) until script.Parent:FindFirstChild("Blood")

if Blood then

wait(5)

Blood.Transparency = 0.3
wait(0.1)
Blood.Transparency = 0.4
wait(0.1)
Blood.Transparency = 0.5
wait(0.1)
Blood.Transparency = 0.6
wait(0.1)
Blood.Transparency = 0.7
wait(0.1)
Blood.Transparency = 0.8
wait(0.1)
Blood.Transparency = 0.9
wait(0.1)
Blood.Transparency = 1

wait(0.01)

Blood:Remove()

wait(60)

for _, Part in pairs(Part.Parent:children()) do
if Part:IsA("Part") then

Part.Transparency = 0.1
wait(0.1)
Part.Transparency = 0.2
wait(0.1)
Part.Transparency = 0.3
wait(0.1)
Part.Transparency = 0.4
wait(0.1)
Part.Transparency = 0.5
wait(0.1)
Part.Transparency = 0.6
wait(0.1)
Part.Transparency = 0.7
wait(0.1)
Part.Transparency = 0.8
wait(0.1)
Part.Transparency = 0.9
wait(0.1)
Part.Transparency = 1
wait(0.01)
script.Parent.Parent:Remove()

end

Here is the output:

Workspace.Zombie.Blood.Clean:54: 'end' expected (to close 'for' at line 29) near eof
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:14 PM
Oh, and uhm, by the way, the script that cleans the blood and body realistically is called Clean.
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
02 Jul 2012 03:23 PM
or _, Part in pairs(Part.Parent:children()) do
if Part:IsA("Part") then

Part.Transparency = 0.1
wait(0.1)
Part.Transparency = 0.2
wait(0.1)
Part.Transparency = 0.3
wait(0.1)
Part.Transparency = 0.4
wait(0.1)
Part.Transparency = 0.5
wait(0.1)
Part.Transparency = 0.6
wait(0.1)
Part.Transparency = 0.7
wait(0.1)
Part.Transparency = 0.8
wait(0.1)
Part.Transparency = 0.9
wait(0.1)
Part.Transparency = 1
wait(0.01)
script.Parent.Parent:Remove()

end -- if

U have no end -- for

Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:31 PM
? Can you post the corrected ver.?
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
02 Jul 2012 03:39 PM
YOU FORGOT AN END TO CLOSE "for"

If You made this, then what We're saying should be easy for You understand.
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:47 PM
Well, the truth is, I haven't played ROBLOX in almost a year. I think I know what you mean though.
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:49 PM
Do you mean:

for _, Part in pairs(Part.Parent:children()) do
if Part:IsA("Part") then

end

Part.Transparency = 0.1
wait(0.1)
Part.Transparency = 0.2
wait(0.1)
Part.Transparency = 0.3
wait(0.1)
Part.Transparency = 0.4
wait(0.1)
Part.Transparency = 0.5
wait(0.1)
Part.Transparency = 0.6
wait(0.1)
Part.Transparency = 0.7
wait(0.1)
Part.Transparency = 0.8
wait(0.1)
Part.Transparency = 0.9
wait(0.1)
Part.Transparency = 1
wait(0.01)
script.Parent.Parent:Remove()
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:50 PM
I apologies I haven't played ROBLOX in a while.
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:52 PM
I apologize*
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 03:59 PM
I have to go somewhere, I'll be back shortly. It would be nice if I could get some answers, I haven't been on ROBLOX for almost a year until now, so my knowledge of scripting has decreased.
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 05:09 PM
Back. Anyone?
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 05:21 PM
Bump.
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 05:26 PM
anyone?
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
02 Jul 2012 05:27 PM
Just add an end after the end you already have at the bottom
Report Abuse
mrpricetoyou is not online. mrpricetoyou
Joined: 25 Nov 2011
Total Posts: 5160
02 Jul 2012 05:28 PM
Forever alone.
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 05:29 PM
oh lol thanks mrpr
Report Abuse
shahin9311 is not online. shahin9311
Joined: 25 Jun 2009
Total Posts: 2542
02 Jul 2012 05:30 PM
i meant whiterain but mr, desperate times calls for desperate measures
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