|
| 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 |
|
|
|
| 15 Mar 2014 08:43 PM |
| It turns it into a random non working handle |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2014 08:44 PM |
1.did you define "Humanoid"? 2.Humanoid.Health = Humanoid.Health-10 |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2014 08:54 PM |
| oh do you have to do that O_O. would i just say exactly that |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|