I’ve made my own jumping script, because I want to customize how jumping works in my game. Sometimes it works, and sometimes it doesn’t. I believe this is due to a bug in Studio, and I’m almost certain that I’ve found a way to consistently reproduce this, at least on my own machine. I’m on Windows 10 Home 1809.
I use ContextActionService:BindActionAtPriority("jumpAction", jump, false, 1000, Enum.KeyCode.Space)
to overwrite the default jumping action. I’ve inspected the developer console action bindings when it works and doesn’t work, and confirmed that when it breaks, the action is never bound. I’ve tried using BindAction
instead, and I’ve tried binding to Enum.PlayerAction.CharacterJump
instead of the space bar specifically. In all cases the Steps to reproduce work.
I’m unable to reproduce this bug in-game, i.e. outside of Studio.
Steps to reproduce:
Using the method detailed below, I can reproduce the bug 100% of the time.
Setup:
Here’s a link to download the place file.
Alternatively, I’ve managed to pare the place down to the essentials of reproducing the bug:
Make a LocalScript
called “JumpScript” and put it in StarterPlayerScripts
.
Add the following code to the script
local ActionService = game:GetService("ContextActionService")
local player = game.Players.LocalPlayer
function jump(_, inputState)
print("jumping")
end
function initialize()
spawn(function()
local playerScripts = player:WaitForChild("PlayerScripts")
local controlScript = playerScripts:WaitForChild("PlayerModule")
--ActionService:BindActionAtPriority("jumpAction", jump, false, 1000, Enum.KeyCode.Space)
ActionService:BindAction("jumpAction", jump, false, Enum.PlayerActions.CharacterJump)
end)
end
initialize()
Breaking the script
In StarterPlayer.StarterPlayerScripts.JumpScript
, at line 48 (line 9 in pared down version) an anonoymous function is called with a spawn
statement. Add or remove an empty line after line 51 (line 14 in pared down version), then save the game by pressing Ctrl+S
. Press F5
to test the place. Jumping should now be broken, so that pressing the space bar does nothing. Inspecting the developer console action bindings window should reveal an action called “jumpAction” at priority 2000, this is not the bound action from my custom jumping script, but the default roblox controls.
Fixing the script
Withing making any changes to the script, save the place by pressing Ctrl+S
.
Saving twice after making the changes detailed in Breaking the script does not prevent the script from breaking.
More details
Saving the game by clicking on FILE > Save to File does not break the script. Adding a newline anywhere else in the script also breaks the script. Other types of change to the script also break the script. Other types of changes to the place (e.g. adding a Part) doesn’t break the script.