Something works properly in Roblox Studio, but breaks when it's published

The sphere that the player controls in this game is supposed to move when a player forces it to, and it does that it Roblox Studio. Whenever I play the game after publishing it, the sphere randomly jumps and moves in different directions, instead of the direction it’s supposed to go in. AutoJump is disabled, so it doesn’t have anything to do with that.

Here’s an example of how it works in Roblox Studio:
https://gyazo.com/7e988e7d94b6a6a3e16bc6797cd368d9

And this is how it works when you play the game normally:
https://gyazo.com/598a07ff6dbc3bc8f824c5b5c3631880

You need to show us your code. We can’t help unless you show us what you did. Thanks

1 Like

Seen somthing like this issue before. Example: I did a script that did hide the leaderboard ingame, did work perfectly in studio. Didn’t work in game. (I fixed the issue)

Would you mind explaining how you fixed it? I might be able to follow your steps and resolve this, or at least figure out why it doesn’t work.

I did have the script in workspace, but then I changed the script to a local script and moved it to startergui, and it did work perfectly.

Alright, I’ll try changing this to a local script. It’s probably a different solution to what you did since the problems aren’t really related, but it might resolve it.

Post more details here, otherwise it can’t be helped.

Be sure you’re handling it from a LocalScript, and make sure you’re properly waiting for all necessary events to occur. Use print statements to try and find any oddities in the code.

(sidenote: that looks super fun!)