Local Script not functioning when it should

I am attempting to create a script which will play music based on ClockTime but only if you are outside of two spheres. The local script is not running despite the fact that it has no errors. I did a quick google search but it is a child of PlayerScripts, which is the issue all others ran into. The image shows this. (The script is “TimeMusicScript”)
image

1 Like

and… the script?

4 Likes

we need to imagine it.
random pic:
image

3 Likes

Use a server script. When the condition is met to play the music “play music based on ClockTime but only if you are outside of two spheres”, then you fire a server to client remote event to the player (LocalScript) to play the music.

1 Like

Dam and Village are the two spheres that cannot be touched.


Below is the same thing with numbers corresponding to the hour it plays. Is it an issue with the function part of the script? I’m rather forgetful and might be using the wrong function or something

1 Like

Have you checked the output while running this? If this script is in StarterPlayerScripts, then you shouldn’t be running the GetPlayerFromCharacter function whenever the player touches a part.

Also, I think you would have to use something like this on the 4th line:

If otherPart.Name == “Dam” or otherPart.Name == “Village” then

Let me know if this helps

1 Like