LocalScript not working properly

Pretty much the LocalScript works when I am testing the game in Studio but when I go to a public server in the actual game it won’t work properly.


image
this is what happens when I’m in testing:
robloxapp-20240526-1903500.wmv (794.1 KB)
this is what happens when I’m in the actual game:
robloxapp-20240526-1904385.wmv (1.0 MB)

1 Like

also the local script is to control inputs in the game for example when the player clicks the punch animation plays or when the player presses f the block animation plays

1 Like

Have you published the updated place to roblox?

Yeah , I did it still didnt work.

1 Like

Are there any errors when you test it in a public game? Also, you should be disconnecting the old event connections whenever a character is added since it will build up. Personally, I will just have that code on the outside and not run it whenever a character is added

there aren’t any errors other than the fact that the things that are in the local script wont run when im in a public server. I will try doing what u said though

Im guessing the character is loaded BEFORE the local script runs, therefore the character added wont fire as the character is already there. You could just check if the character is already there and run that same code that is inside the character added event

1 Like

it worked thank you so much man

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