Code has slightly different behavior outside of studio environment

Issue:
proximity boss music for some reason has a bit of a different behavior outside of studio,
works fine in studio, doesn’t really work as it should outside of it

Expected Behavior:


(the music starts the moment LastHitTick num value gets set to the current tick and keeps playing for the next 2 minutes, the LastHitTick value is controlled by the server)
image
code snippet that controls LastHitTick value

Current Behavior:


(the music only starts when the server sets the target value to the localplayer, and the music does not keep playing after the target value is reset,)

code snippet that controls the Target value

Code that handles the music playing:


(the max range and min range values can be ignored)
image

Notes:

  • the script that handles the music playing is fully client-sided
  • the script that handles updating the LastHitTick number value is fully server-sided
  • the client takes approximately a minute to load into the game
  • there are no errors in the console

pardon the very low video quality,
as the game’s brutal visuals make the video file sizes absurdly large in mere seconds

tick() is different on both client and server, as it takes local time relative to the player/server timezone. It has a different behavior outside of studio, as studio playtest server is hosted locally on your machine.

1 Like

i didnt even think about that, thanks

changed the code up to use os.time instead of tick() and it solved the issue
image

image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.