So I made a ragdoll scripts which triggers a function where It plays a sounds everytime a ragdolled character collides with any surface, and Its ID deppends of the strength of the collision. The problem I got is that the sound played is only heard by the player, so if another player sees the other one collide, they can't hear the sound.
Do you know how to fix it?
I'll leave my script here. The "part" parameter are for the body parts of the character, such as the arms or the torso.
function playSound(part,intensity,bool) if bool then local sound = Instance.new("Sound",part) sound.PlaybackSpeed = math.random(8,12)/10 if intensity < 5 then sound.SoundId = "http://www.roblox.com/asset/?id=131237241" sound.Volume = intensity/5 elseif intensity < 10 then sound.SoundId = "http://www.roblox.com/asset/?id=74388682" sound.Volume = 1 elseif intensity < 50 then sound.SoundId = "http://www.roblox.com/asset/?id=1159504677" sound.Volume = 1 else sound.SoundId = "http://www.roblox.com/asset/?id=314390675" sound.Volume = 3 end sound:Play() bool = false wait(0.4) bool = true wait(1.6) sound:Destroy() end end
The newer Roblox no longer replicates sounds and things coming from a client (due to exploiters) so they fixed this issue by using "FilteringEnabled." So basically anything that is done in the client side (localscripts and such) doesn't show up for anyone but the client. You use things such as "ServerEvents" and "ServerFunctions." They both do the same thing but are slightly different.
"ServerEvents" and "ServerFunctions" are used to call scripts that the server handles and replicates throughout the clients. They are very easy to learn and such (although you must learn them if you want your game to actually show up on the main page).
Here are super great tutorials for using them (thanks to AlvinBLOX): https://www.youtube.com/watch?v=wic-N4JiFss&t=534s https://www.youtube.com/watch?v=-KqiPiE5P74
If you have any questions or issues, please contact me (In case you didn't understand the tutorials). ;)
Ok. I have read about It, and I understood how It works. However, the only issue I'm having is to execute It as a coroutine.
I mean, are you able to create a coroutine with ":FireServer()" ?