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: Sorry Im a basic scripter but help..

Previous Thread :: Next Thread 
dasfunny is not online. dasfunny
Joined: 24 Jan 2011
Total Posts: 911
25 Jun 2012 12:44 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.MaxHealh = h.Health + 10
h.Health = h.Health + 10
h.WalkSpeed = h.WalkSpeed - 2

end
end

script.Parent.Touched:connect(onTouched)


How would I stop there health from going up if there health waas 1000 and up
and there walkspeed was 0 or lower
So basicly a cap
Report Abuse
LordSymphonic is not online. LordSymphonic
Joined: 20 Jun 2012
Total Posts: 101
25 Jun 2012 12:45 PM
    function onTouched(part)
    local h = part.Parent:findFirstChild("Humanoid")
    if h~=nil and h.MaxHealth ~= 1000 then
    h.MaxHealh = h.Health + 10
    h.Health = h.Health + 10
    h.WalkSpeed = h.WalkSpeed - 2
    end
    end
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
25 Jun 2012 12:48 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
if h.MaxHealth < 1000 then
h.MaxHealh = h.Health + 10
h.Health = h.Health + 10
h.WalkSpeed = h.WalkSpeed - 2

end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
dasfunny is not online. dasfunny
Joined: 24 Jan 2011
Total Posts: 911
25 Jun 2012 12:51 PM
so

function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil and h.MaxHealth ~= 1000 then
h.MaxHealh = h.MaxHealth + 10 -- foorgot to fix the Error here
h.Health = h.Health + 10
h.WalkSpeed = h.WalkSpeed - 2
end
end

Still no work ANyone help?

Report Abuse
LordSymphonic is not online. LordSymphonic
Joined: 20 Jun 2012
Total Posts: 101
25 Jun 2012 12:51 PM
Yes, The's would actually be better in this case, as mine only checks the exact amount of "1000".
Report Abuse
LordSymphonic is not online. LordSymphonic
Joined: 20 Jun 2012
Total Posts: 101
25 Jun 2012 12:52 PM
    function onTouched(part)
    local h = part.Parent:findFirstChild("Humanoid")
    if h~=nil and h.MaxHealth < 1000 then
    h.MaxHealth = h.MaxHealth + 10
    h.Health = h.Health + 10
    h.WalkSpeed = h.WalkSpeed - 2
    end
    end
    script.Parent.Touched:connect(onTouched)
Report Abuse
dasfunny is not online. dasfunny
Joined: 24 Jan 2011
Total Posts: 911
25 Jun 2012 12:55 PM
Wuld I do walkspeed the same way you did Health
btw workss
Report Abuse
LordSymphonic is not online. LordSymphonic
Joined: 20 Jun 2012
Total Posts: 101
25 Jun 2012 12:58 PM
No problem. And I would do:

function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h then
if h.MaxHealth < 1000 then
h.MaxHealth = h.MaxHealth + 10
h.Health = h.Health + 10
elseif h.WalkSpeed < 20 then --or something else
h.WalkSpeed = h.WalkSpeed - 2
end
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
dasfunny is not online. dasfunny
Joined: 24 Jan 2011
Total Posts: 911
25 Jun 2012 01:00 PM
is there Any wya to FIND the person that used the weapon and increase there Health and walkspeeD?
Report Abuse
LordSymphonic is not online. LordSymphonic
Joined: 20 Jun 2012
Total Posts: 101
25 Jun 2012 01:04 PM
Weapon? Find?
Report Abuse
dasfunny is not online. dasfunny
Joined: 24 Jan 2011
Total Posts: 911
25 Jun 2012 01:06 PM
No for example It doesn't Damage teh tools user.
Report Abuse
BladzofChaos70 is not online. BladzofChaos70
Joined: 27 Sep 2008
Total Posts: 2550
25 Jun 2012 01:16 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h and (h.MaxHealth < 1000) and (part.Parent~=script.Parent.Parent) then -- or wherever the player is from the tool
h.MaxHealth = h.MaxHealth + 10
h.Health = h.Health + 10
elseif h.WalkSpeed < 20 then --or something else
h.WalkSpeed = h.WalkSpeed - 2
end
end
end
script.Parent.Touched:connect(onTouched)
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