New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
2

Disabling space key?

Asked by 3 years ago

I can't figure out how to disable the space key. I need this because I'm making a racing game where I don't want players to jump out of the cars. Why isn't this working, and what can I do to make it work?

This is what I've tried:

Instance.new("HumanoidController", game:GetService("ControllerService")):UnbindButton(32)
0
Thank you so much! RepeatLua 85 — 3y
0
No problem @RepeatLua alphawolvess 1699 — 3y

1 answer

Log in to vote
4
Answered by 3 years ago

This is a great way to use ROBLOX's new update on JumpPower for Humanoids! I've tested this and it appears to work!

This line of code would be a basic Idea, but it would remove the ability of jumping forever, so if you ever want them to jump, you must make some adjustments!

--local script, inside of StarterPack
local Plr = game.Players.LocalPlayer 
repeat wait() until Plr.Character -- make sure the Player's character exists
local Hum = Plr.Character:WaitForChild("Humanoid") -- Lets get the Humanoid; wait until it exists

Hum.JumpPower = 0
0
would be a lot more efficient just to use characteradded in a server script, because this is not fe-compatible unmiss 337 — 3y
0
Yes, this is FE compatible. Characters get replicated. RepeatLua 85 — 3y
Ad

Answer this question