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
 

Wait WHA Help with script (like 1 line xD)

Previous Thread :: Next Thread 
Wolfhead666 is not online. Wolfhead666
Joined: 13 Jan 2010
Total Posts: 881
15 Mar 2014 08:39 PM
I have a survival game and all the food works great EXCEPT my newest creation roadkill xD. I Took one of the foods that already worked great and changed the mesh and added only ONE LINE.

Humanoid.Health = -10

See I want roadkill you hurt you but replenish hunger so...ya...is my one line script wrong or is it something else?
(Tell me if you need to see the script[56 lines])
Report Abuse
Wolfhead666 is not online. Wolfhead666
Joined: 13 Jan 2010
Total Posts: 881
15 Mar 2014 08:43 PM
It turns it into a random non working handle
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
15 Mar 2014 08:44 PM
1.did you define "Humanoid"?
2.Humanoid.Health = Humanoid.Health-10
Report Abuse
Wolfhead666 is not online. Wolfhead666
Joined: 13 Jan 2010
Total Posts: 881
15 Mar 2014 08:54 PM
oh do you have to do that O_O. would i just say exactly that
Report Abuse
Wolfhead666 is not online. Wolfhead666
Joined: 13 Jan 2010
Total Posts: 881
15 Mar 2014 09:02 PM
hmm it still doesnt work, here is the script (made that change you said).

local Tool = script.Parent;
healer = 10 --Change this to how much you want the person to heal when they eat this.
timesUsable = 1 --Change this to how many times you want to use the tool. "Unlimited" with quotes is unlimited times.
enabled = true
timesUsed = 0 --DON'T MESS WITH THIS VARIABLE!
Humanoid.Health = Humanoid.Health-10


function onActivated()
if not enabled then
return
end

enabled = false
Tool.GripForward = Vector3.new(-0.976,0,-0.217)
Tool.GripPos = Vector3.new(.95,-0.76,1.4)
Tool.GripRight = Vector3.new(0.217,0, 0.976)
Tool.GripUp = Vector3.new(0,1,0)


Tool.Handle.DrinkSound:Play()

wait(.8)

local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
if game.Players:findFirstChild(Tool.Parent.Name).PlayerGui.HungerGUI.Frame.Size.X.Offset >= 2 then
game.Players:findFirstChild(Tool.Parent.Name).PlayerGui.HungerGUI.Frame.Size = game.Players:findFirstChild(Tool.Parent.Name).PlayerGui.HungerGUI.Frame.Size + UDim2.new(0,healer,0,0)
if game.Players:findFirstChild(Tool.Parent.Name).PlayerGui.HungerGUI.Frame.Size.X.Offset >= 200 then
game.Players:findFirstChild(Tool.Parent.Name).PlayerGui.HungerGUI.Frame.Size = UDim2.new(0,200,0,20)
end
end end

Tool.GripForward = Vector3.new(-0.976,0,-0.217)
Tool.GripPos = Vector3.new(0.3,0,0)
Tool.GripRight = Vector3.new(0.217,0,-0.976)
Tool.GripUp = Vector3.new(0,1,0)

if timesUsable ~= "Unlimited" then
timesUsed = timesUsed + 1
if timesUsed >= timesUsable then
Tool:remove()
end
end

enabled = true

end

function onEquipped()
Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
Report Abuse
Wolfhead666 is not online. Wolfhead666
Joined: 13 Jan 2010
Total Posts: 881
15 Mar 2014 09:17 PM
OMG WOOT WROTE MY FIRST WORKING SCRIPT XD (Im learning). I added a 2nd script :D


local Tool = script.Parent;

function onActivated()
if not Tool.Enabled then
return
end
local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2
wait(0.01)
h.Health = h.Health - 2

script.Parent:Remove()

end

function onEquipped()

end
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
15 Mar 2014 10:04 PM
You can make that a lot easier:

for i = 1,10 do
h.Health = h.Health -2
wait(.01)
end
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
15 Mar 2014 10:06 PM
wait(0.01) can only wait like 1/30th of a second, which is the same as wait()
Report Abuse
Wolfhead666 is not online. Wolfhead666
Joined: 13 Jan 2010
Total Posts: 881
15 Mar 2014 10:28 PM
oh.....ur right xD i wanted it to be visibly going down, stopping...going down, stopping etc
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