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: How would I...

Previous Thread :: Next Thread 
Hibobb is not online. Hibobb
Joined: 18 Apr 2010
Total Posts: 2146
20 Jun 2013 05:10 PM
How would I create a tool that upon the player left clicking, heals whoever hes clicking on and upon right clicking, heals themselves? I'm not asking for the script, I would prefer to do it myself.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
20 Jun 2013 05:13 PM
Something like this in a localscript in a tool:

local Tool = script.Parent

Tool.Equipped:connect(function(Mouse)
Mouse.Button1Down:connect(function()
local Target = Mouse.Target
local Humanoid = Target.Parent:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Health = Humanoid.MaxHealth
end
end)
Mouse.Button2Down:connect(function()
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
Humanoid.Health = Humanoid.MaxHealth
end)
end)
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
20 Jun 2013 05:23 PM
That's the basics at least. Some suggestions for additions:

1) Maximum range
2) Setting the mouse's icon to something other than the default.
3) Reload time
4) Raycasting so you can't heal through walls.
Report Abuse
Hibobb is not online. Hibobb
Joined: 18 Apr 2010
Total Posts: 2146
20 Jun 2013 05:47 PM
Oh jeez... I would need help with all that. I know I can do the second one and I inserted the third one already. I know for the first one you need to use magnitude but i dont know how, and the fourth one I dont know how to do at all.
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