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: HealthBall

Previous Thread :: Next Thread 
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 07:54 AM
Begginer scripter here :3

I made this "Health ball" script and its a bit broken..

I think i forgot an End or i messed it up :P

while true do wait (2)
x = Instance.new("Part")
x.Parent = game.Workspace
x.Shape = "Ball" x.Position = game.Workspace.CubeBuilder12.Head.Position
x.BrickColor = BrickColor.Random()
x.Transparency = 0.4
x.Name = "HealthBall"

function onTouched(hit)
human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = 100
end
end

script.Parent.Touched:connect(onTouched)


Instance.new("Decal",game.Workspace.HealthBall).Texture = "http://www.roblox.com/asset/?id=96574021"
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 07:56 AM
Anyone there? help :(
Report Abuse
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
10 Mar 2013 08:02 AM
Try this.

while true do wait (2)
x = Instance.new("Part")
x.Parent = game.Workspace
m=Instance.new("Decal",game.Workspace.HealthBall).Texture"http://www.roblox.com/asset/?id=96574021"
m.Parent = x
x.Shape = "Ball" x.Position = game.Workspace.CubeBuilder12.Head.Position
-- Not sure why you have two equal signs here, that part is for you to fix. /\
x.BrickColor = BrickColor.Random()
x.Transparency = 0.4
x.Name = "HealthBall"
end
function onTouched(hit)
human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = 100
end
end

script.Parent.Touched:connect(onTouched)


Instance.new("Decal",game.Workspace.HealthBall).Texture = "http://www.roblox.com/asset/?id=96574021"
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 08:04 AM
^Thanks im gonna try that
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 08:07 AM
^dint work

I fixed the position but it dint work
Report Abuse
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
10 Mar 2013 08:12 AM
What does the output say?
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 08:14 AM
Healthball is not a valid member of workspace .-.
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 11:11 AM
bump
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
10 Mar 2013 11:14 AM
You did miss an end, but it's a bit more then that. A while true do loop will keep doing the code inbetween it and the matching end forever, meaning it will never reach the connection line for Touched.



function onTouched(hit)
human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = 100
end
end

script.Parent.Touched:connect(onTouched)

while true do wait (2)
x = Instance.new("Part")
x.Parent = game.Workspace
x.Shape = "Ball"
x.Position = game.Workspace.CubeBuilder12.Head.Position
x.BrickColor = BrickColor.Random()
x.Transparency = 0.4
x.Name = "HealthBall"
end
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 11:17 AM
Wow rendersettings fixed my script e_o

Cube will test dat
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 11:19 AM
Nope broken.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
10 Mar 2013 11:20 AM
I...can't tell if that is supposed to be positive or not.
I missed a part when copy-pasting though.

function onTouched(hit)
human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = 100
end
end

while true do wait (2)
x = Instance.new("Part")
x.Parent = game.Workspace
x.Shape = "Ball"
x.Position = game.Workspace.CubeBuilder12.Head.Position
x.BrickColor = BrickColor.Random()
x.Transparency = 0.4
x.Name = "HealthBall"

x.Touched:connect(onTouched) --I assume you actually wanted the BALL to heal you, and not script.Parent. Sorry.

Instance.new("Decal",x).Texture = "http://www.roblox.com/asset/?id=96574021"
end
Report Abuse
CubeBuilder12 is not online. CubeBuilder12
Joined: 21 Nov 2011
Total Posts: 14596
10 Mar 2013 11:24 AM
IT WORKED!!! THANKS MASTERSCRIPTER YA

My very first script! yeeeees
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