I am making a simple soundboard for my brother, and i am trying to make the sound come from the players character, while being heard by every player in a certain distance. I am not very skilled when it comes to scripting, so is this possible, and if so how is this achievable.

It is likely that you can use a RemoteEvent for this case,
To put it Simply, RemoteEvents are essentially Blocks of Code that are send between Context Levels (Server and Client)
Client (LocalScript)
This is the Player, You,
The Changes on this side will only affect you
Server (Script)
This is the Server, Server doesn’t know you
The Changes here will affect everyone.
If you are Sending Data to the Server, you use the Server so it can retrieve that data.
If you are Sending Data to the Client, you are use the Client so it can do the same
Server Script Connection: OnServerEvent
Client Script Connection: OnClientEvent
For OnServerEvent, you have Access to the Player
-- On a Regular Script
RemoteEvent.OnServerEvent:Connect(function(Player) -- Player Argument
print(Player)
end)
-- On a LocalScript:
RemoteEvent:FireServer() -- will Print Players name
For OnClientEvent, you have to insert the Player
-- On a LocalScript
RemoteEvent.OnClientEvent:Connect(function() -- no Player Argument
print(game.Players.LocalPlayer)
end)
-- On a Regular Script:
RemoteEvent:FireClient(Player) -- will Print Players name and only fire for them
RemoteEvent:FireAllClients() -- Fires for All Players
I would Recommend learning a bit Later on however, make sure you have a understanding on Lua Basics
@canyoumakemeinavideo Please don’t be lazy, Actually Explain what it is and how to do it rather than giving a vague Suggestion, Especially since this person has a small understanding of Scripting
Just to add on to what has been said already…
The reason you need a remote event is because the sound has to be played by a server script in order to be heard by everyone.
If it is played by a localscript, only that user will hear it.
everyone’s saying the solution for letting the sound be heard by everyone, but to change the distance at which the sound can be heard you have to change its RollOffMaxDistance (property of all sounds) Sound | Roblox Creator Documentation
aka, you want it to be only hearable if someone’s within 100 studs of the sound, you make the rolloffmaxdistance 100
-
API?

Documentation Covers API -
Explanation?

-
Code Snippet?

You Aren’t understanding what I’m saying,
I’m just saying Provide an Example of how it can be used for their code.
Yes, there may be Other Posts, Yes they may have Solutions, but they may not know that, or aren’t able to find what they are looking for, There is a variety of Topics that involve RemoteEvents in which aren’t the same as this one, They may be related with RemoteEvents, but they may look confusing when looking at it first glance (Just like my post).
I’m just saying write more than “Use a RemoteEvent”
If you have anything more to say, PM me
I am very grateful that he provided extra information with the answer.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.