BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 01:02 AM |
Where did I go wrong?
game.Players:PlayerAdded:connect(function() if v and v.Character and v.Character:FindFirstChild("Humanoid") then local enabled = true while wait() do if v.Humanoid.Jump == true and enabled == true then v.Humanoid.Health = v.Humanoid.Health - 25 enabled = false wait(0.3) enabled = true end end end end)
Please, don't write a whole new script, I'd like for a part of this one to be edited so that I can see what I had done wrong. |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
| |
|
|
| 10 Jun 2014 01:52 AM |
Well firstly, you can at least go into a bit more detail as to what you wanting the script to do.
Also none of your variables are declared. Unless you left those out, but it would be nice if you could post those also. |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 01:54 AM |
Oh, I see now. I'm pretty tired..
A friend suggested that I change it in a way, but then I forgot to change the rest to match it.
Here's the original script that I actually want to know about. |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 01:54 AM |
for i, v in ipairs(game.Players:GetChildren()) do if v and v.Character and v.Character:FindFirstChild("Humanoid") then local enabled = true while wait() do if v.Humanoid.Jump == true and enabled == true then v.Humanoid.Health = v.Humanoid.Health - 25 enabled = false wait(0.3) enabled = true end end end end |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 01:57 AM |
for A,A in pairs(game.Players:GetChildren()) do if A.Character:FindFirstChild("Humanoid") then A.Character.Humanoid.Jumping:connect(function(JUMP) if JUMP==true then A.Character.Humanoid.Health=A.Character.Humanoid.Health-25 end end) end end |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 01:58 AM |
or
function JUMPING(JUMP) if JUMP==true then A.Character.Humanoid.Health=A.Character.Humanoid.Health-25 end end
for A,A in pairs(game.Players:GetChildren()) do if A.Character:FindFirstChild("Humanoid") then A.Character.Humanoid.Jumping:connect(JUMPING) end end |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 02:04 AM |
| I don't see why that doesn't work, but.. It doesn't. |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 10 Jun 2014 02:05 AM |
Where did I go wrong?
game.Players:PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(v) local enabled = true v.Humanoid.Changed:connect(function() if v.Humanoid.Jump == true and enabled == true then v.Humanoid.Health = v.Humanoid.Health - 25 enabled = false wait(0.3) enabled = true end end end) end) |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:08 AM |
> vlekje513
You had "game.Players:PlayerAdded" when it should be "game.Players.PlayerAdded"
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(v) local enabled = true v.Humanoid.Changed:connect(function() if v.Humanoid.Jump == true and enabled == true then v.Humanoid.Health = v.Humanoid.Health - 25 enabled = false wait(0.3) enabled = true end end end) end) |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 02:09 AM |
--[[ I didn't test it beforehand last time. I know why it didn't work, and I simply made a silly mistake. --]]
game.Workspace.ChildAdded:connect(function(CHAR) if CHAR:FindFirstChild("Humanoid") then CHAR.Humanoid.Jumping:connect(function(JUMP) if JUMP==true then CHAR.Humanoid.Health=CHAR.Humanoid.Health-25 else end end) end end)
--BLOXLUA |
|
|
| Report Abuse |
|
|
uyoyalt
|
  |
| Joined: 16 Apr 2013 |
| Total Posts: 2860 |
|
|
| 10 Jun 2014 02:09 AM |
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character and p.Character:findFirstChild("Humanoid") p.Character.Humanoid.Changed:connect(function(ch) if ch == "Jump" then p.Character.Humanoid.Health = p.Character.Humanoid.Health - 25 end end) end) |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 02:15 AM |
This works other than the debounce. On jump you just die instantaneously.
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(v) v.Humanoid.Changed:connect(function() local enabled = true if v.Humanoid.Jump == true and enabled == true then v.Humanoid.Health = v.Humanoid.Health - 25 enabled = false wait(0.3) enabled = true end end) end) end)
|
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 02:17 AM |
| BaconSoap, I tested mine, and it works. Why not just use it? =) |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 10 Jun 2014 02:18 AM |
Damage = 25
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(v) local enabled = true v.Humanoid.Changed:connect(function() if v.Humanoid.Jump == true and enabled == true then v.Humanoid.Health = v.Humanoid.Health - Damage enabled = false wait(0.3) enabled = true end end) end) end) |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 02:19 AM |
I just tried it, and it worked, FINALLY.
But what was the error in the previous version? |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 02:21 AM |
| Don't know if you're talking to me... |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 02:22 AM |
| Yes, Alex, I'm talking to you. |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 02:23 AM |
| Oh, well, I wanted to do the for loop like you did, but it didn't work because it would only run it once. So, I make it check all the characters that spawn instead, and it worked. |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Jun 2014 02:25 AM |
Cool, makes sense.
Thanks for the help. The script is being used in my unfinished game. |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
| |
|