|
| 25 Feb 2015 08:47 AM |
Hey, I'm trying to prevent bunnyhoppers on my game as the :Touched event seems to not be firing randomly due to the bad ROBLOX physics :P
When I have this:
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() game.Players.LocalPlayer.Character.Humanoid.Jump = false end)
I can't jump at all. I thought 'Well, great! So all I need to do is add a cooldown now and there will be no bunnyhoppers!'
I was wrong.
local cooldown = false
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() if cooldown == false then game.Players.LocalPlayer.Character.Humanoid.Jump = false cooldown = true wait(1) cooldown = false end end)
It turns out that if you have anything before disabling the jump, the jump won't disable;/
Does anyone have any ideas on how I could prevent bunnyhopping? |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 25 Feb 2015 08:51 AM |
| You could make a "CanCollide = false" part which has the kill script inside of it and on top of the killing part. |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 25 Feb 2015 08:51 AM |
"Bunny hopping"
Idk what you are trying to do but you could
blah blah blah.changed game.Players.LocalPLayer.Character.Humanoid.Jump = false end
--local
keydown = 'spacebar' do if cooldown = false then game.Players.LocalPlayer.Character.Humanoid.Jump = true coldown = true end
blah blah blah |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 08:55 AM |
| DaviSky, I don't understand how that has anything to do with preventing bunnyhopping and Crow jump = true won't work if the .Changed is making it false every time :P |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 25 Feb 2015 08:56 AM |
| Oh i thought youre talking if a player touches a brick while jumping repeadetly he doesnt die. |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:04 AM |
Play my game and you'll find out :P
Also, crow that actually might work to some extent because I could create 2 localscripts with one containing:
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() game.Players.LocalPlayer.Character.Humanoid.Jump = false end)
and something like
keydown = 'spacebar' do game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = true game.Players.LocalPlayer.Character.Humanoid.Jump = true game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = false wait(0.9) end
That might not work if the player spams spacebar though ;/ I think the default jump takes around 0.75 seconds long but not too sure, found it out somewhere. |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 25 Feb 2015 09:09 AM |
I think there is a jump finished event. I've seen it done... |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:22 AM |
nope
http://wiki.roblox.com/index.php?title=Category:Events
only event I found about jumping is JumpRequest
http://wiki.roblox.com/index.php?title=JumpRequest_(Event) |
|
|
| Report Abuse |
|
|
Argelius
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 4047 |
|
| |
|
|
| 25 Feb 2015 09:57 AM |
Dayum if I could actually bunnyhop in Roblox i'd be moving really fast through the map
CentOS-Web = /var/www/html/ |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:58 AM |
| No, it ruins my game(TNT RUN SPACE) as the majority of times, the parts won't fall because you didn't touch the part for long enough;/ |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 10:12 AM |
FIXED!
This is rather inefficient, if you know a more efficient method of doing this then feel free to share it<3
First script(not disabled):
repeat wait(0.1) until game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") game.Players.LocalPlayer.PlayerGui.jumplimit.Disabled = false
Second script(Disabled): game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() game.Players.LocalPlayer.Character.Humanoid.Jump = false game.Players.LocalPlayer.PlayerGui.jumplimit3.Disabled = false end)
Third script(Disabled): game:GetService("UserInputService").JumpRequest:connect(function() game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = true game.Players.LocalPlayer.PlayerGui.jumplimit3.Disabled = false end)
Fourth script(Disabled):
game.Players.LocalPlayer.PlayerGui.jumplimit.Disabled = true game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = true game.Players.LocalPlayer.Character.Humanoid.Jump = true wait(0.4) game.Players.LocalPlayer.PlayerGui.jumplimit.Disabled = false wait(0.5) game.Players.LocalPlayer.PlayerGui.jumplimit3.Disabled = true game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = false
--Code by kingstarwest<3 |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 10:22 AM |
I thought getting whenever they jumped and then making Jumping to false stops it...
Or you could have a bodyforce to force them downward
CentOS-Web = /var/www/html/ |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 10:24 AM |
Yeah but that'll prevent players from jumping all together, I just want to prevent players from bunnyhopping.
Bodyforce is probably not the best to use because it'll probably spaz your character out lol |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 10:27 AM |
I had this script in my gun that detected whenever they had space held. I had a while loop for a custom jump animation whenever they were jumping
CentOS-Web = /var/www/html/ |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 11:54 AM |
UPDATE: I've made this work but there seems to be a problem with it as the player is forced to jump on an IPAD, Can anyone help me out?
jumplimitload: repeat wait(0.1) until game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") game.Players.LocalPlayer.PlayerGui.jumplimit.Disabled = false
jumplimit: game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() game.Players.LocalPlayer.Character.Humanoid.Jump = false game.Players.LocalPlayer.PlayerGui.jumplimit3.Disabled = false end)
jumplimit2: game:GetService("UserInputService").JumpRequest:connect(function() game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = true game.Players.LocalPlayer.PlayerGui.jumplimit3.Disabled = false end)
jumplimit3: game.Players.LocalPlayer.PlayerGui.jumplimit.Disabled = true game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = true game.Players.LocalPlayer.Character.Humanoid.Jump = true wait(0.4) game.Players.LocalPlayer.PlayerGui.jumplimit.Disabled = false wait(0.5) game.Players.LocalPlayer.PlayerGui.jumplimit3.Disabled = true game.Players.LocalPlayer.PlayerGui.jumplimit2.Disabled = false
It's very inefficient and was wrote a long time ago, anyone know any updated methods?
|
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:12 PM |
bump
made a cool bounce
--- local cooldown = false
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character.Humanoid.Changed:connect(function() if cooldown == false then character.Humanoid.Jump = false wait(0.1) cooldown = true character.Humanoid.Jump = true wait(0.5) cooldown = false end end) end) end) --- |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 22 May 2015 12:13 PM |
local humanoid = script.Parent:WaitForChild("Humanoid") local cooldown = 1 local coolling = false local last = nil
humanoid.Changed:connect(function() if last then if tick() - last >= cooldown then coolling = false end end if not coolling then coolling = true last = tick() else humanoid.Jump = false end end)
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:17 PM |
Did you try this:
local cooldown = true
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() game.Players.LocalPlayer.Character.Humanoid.Jump = false if cooldown then cooldown = false game.Players.LocalPlayer.Torso.Velocity = Vector3.new(0, 5, 0) --Change 5 to a larger or smaller number until it works just like a regular jump :P wait(1) cooldown = true end end) |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:21 PM |
Thanks chimmihc! :D
Thanks warspyking but I want to avoid using bodyforces, velocity etc ;D |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:31 PM |
--- local humanoid = script.Parent:WaitForChild("Humanoid") local cooldown = 1 local coolling = false local last = nil
humanoid.Changed:connect(function() if last then if tick() - last >= cooldown then coolling = false end end if not coolling then coolling = true last = tick() else humanoid.Jump = false end end) ---
Works amazingly in test solo but doesn't work on a server? D: |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:32 PM |
| Why would you avoid it? It's the clean way to do this :P |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 22 May 2015 12:41 PM |
How much do I have to bet that you used a server script?
Use a local script.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:45 PM |
Ah, should of guessed xD
Thanks! ;D |
|
|
| Report Abuse |
|
|
|
| 22 May 2015 12:52 PM |
| Works online for PC users but now IPAD users can't jump at all xD |
|
|
| Report Abuse |
|
|