# You're probably using the character and local player in the local script, so when pasting the code into a regular script it doesn't work