(SOLVED) How do I make a script/thing so all sounds (even not specified) follow the speed of sound?

Hello, I am wondering how to make something like this for my ACS and all sounds in the game:

Video

I am not the best at scripting haha. and this is my first post on the dev forum, saw today that I am now able to reply and post!
So yeah, just seeing if it is possible!

The first comment reads:

if I had to guess, you used magnitude to determine how far the other players are from the initial shot, and played the sound accordingly with a delay

Try doing something like this:

local distance = (Shot_position - Player_position).Magnitude

wait(distance - BulletSpeedStudsPerSecond)

--sound volume logic could be similar to the wait function logic

Just my guess. Good luck!

1 Like

As I am new to scripting, I really am bad at it lol.
So, sorry if this sounds stupid; but where will I put this script once I use it?

You can’t ask dumb questions (if its intentional) remember that.

You could initially Store the player who is shooting’s position on a local script inside of their player Character (Starter character scripts). And then pass it to a server script through a remoteEvent. And vice versa: Fire back to all clients the location of the shot fired and perform logic through the specific handler for this event, in this case being a bullet fired from afar.

1 Like

also my math is probably wrong on the wait function. You would probably want to divide the distance up into seconds by the bullet speed. So (if it works, that is lmao) instead of distance - bssp you would do

wait(distance / BulletSpeedStudsPerSecond) / 60 

I dont know really how this would work. Give me a minute to find something

1 Like

Alright!
Apparently this has to be t h i r t y characters so: E

Okay, I’ve found something.
Look through this post:

it might help you! Lmk

This is probably better than what I tried showing you lol :sweat_smile:

1 Like

Thanks! I’ll check it out.

Thanks with all this help man, seriously it’s great!

No problem!
Please let me know if you have any more questions.,

for actually following the speed of sound, you could (on the server) fire all clients with the sound and it’s position and (on the client) play the sound with a delay based on the distance

1 Like

How would I do that?
4huisghtsgt

if you don’t have basic to moderate scripting knowledge it’d be weird to interpret what I said, I suggest learning if you want to do things like this

1 Like

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