This post is old and no longer being updated.
Are there any other parts of the script that could be possibly interfering?
I think my old reply was misinterpreting the issue. I now assume the issue is that the print isnât printing like you want it to, not that the sounds are not playing. If thatâs the case, maybe UserInputService.JumpRequest
is what youâre after for jumping? I assume then the issue would be firing too much.
Also, the use of StateChanged from the humanoid is working in my game like this:
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Landed then
print("Landed!")
elseif newState == Enum.HumanoidStateType.Jumping then
print("Jumping!")
end
end)
Old Reply:
Roblox adds a âJumpingâ sound effect to the playerâs HumanoidRootPart (Character) when that player joins a game. You should be able to simply change the SoundID of that, but only on runtime in a script. (Not in studio, annoyingly.)
I donât think so. From what my script contains, I donât believe there should be any conflicts between my other functions and this one.
Yes, sometimes the function prints either way too much are not at all. I have tried UserInputService.JumpRequest just like you stated as well. I have not tried your method, however. I will test it and give an update.
For some reason it is still inconsistent with how it works.
Sometimes it prints only âJumping.â or only âNot jumping.â other times it does not print at all or it prints too much. Still have no idea what the issue could be.
Are you using a custom character/StarterCharacter? (Humanoid HipHeight might be affecting things or something else. )
I am using a StarterCharacter. The character itself doesnât have any outstanding differences of a regular character though. It is just an R6 Rig with customized body colors and a special head mesh attached to it. How might a custom character cause problems?
That doesnât sound like that would cause an issue to me. If the HipHeight
is too low or too high, I assume that impacts what counts as âlandingâ.
Image showing HipHeight property for a custom character of mine.
Other than that, Iâm not sure what the issue could be. Printing based on StateChanged
works fine for my custom character.
Are you using a LocalScript or a ServerScript for StateChanged? I wonder if that is somehow the problem.
I am using a custom Animate Module Script that runs locally, parented to StarterCharacterScripts.
Weird. When I try this locally, no issue. On the server, doesnât work.
Maybe try moving the function to a direct local script
What is a direct LocalScript and where should I place it in my game?
Is the script in a server script or a local script? If it is in a server script or a module try moving it directly to a local script.
It is a server script, but from what I understand, you cannot play sounds from a local script that are heard by all players. Iâm just using print() statements as placeholders to ensure that the function runs consistently.