Hi, I'm currently trying to set up a physical radio model in my social hangout game which users can walk up to and mute the music on their game with, but the way I have it currently configured, it mutes the music for every person in the game and if one person mutes it then nobody can hear it. How can I fix it so when someone interacts with the radio model, it only mutes their music?
#Physical music toggle model
121 messages · Page 1 of 1 (latest)
Also, I would like to add that the audio is coming from the part itself, and i have very little experience scripting. Thank you to anyone who can help.
no hate to you at all, you're still figuring things out. the fix is very simple
studio allows you to create 2 different types of script: a local script and a server script (commonly referred to as a regular script or just a script)
server scripts work by replicating any of its actions to all clients (players), while a local script works by only affecting the player
basically you just need to use a local script rather than a server script
i would highly recommend you look into filtering enabled
it really helps you to understand the functionality and reasons for server-client relations
i tried switching the script to a local script but it doesnt work
do i have to change the actual script inside of it?
also thanks for being polite
i just changed the script to a local script
and used the same script
and it didnt work
yes ofc
so the script wont work at all when its a a local script?
thats what you do want happening
local scripts (with a few exceptions) wont work in the workspace
i believe if you put the radio in replicatedFirst your local script should work
wait lemme see something
ok you'll have to use remote events
do you know how to use those?
no
** You are now Level 5! **
they're very simple
it basically can send information from a local script to a server script and vice versa
oh wait
is it so i can have a local script in replicatedfirst thats actually connected to the model
without the model being its parent?
not quite
you can have a server script in the radio model and a local script in a client service
you can run the remote event on the server script and make the local script disable the radio for only the player
you should probably look into remote events
just lmk once you've done that and ill help you set a remote event up
ok
so i set up the radio model back to how it was before i created this help thread
then i put the same script in a local script in replicatedfirst
not quite
put the local script in starter player scripts
the remote event will go in replicated storage
storage
yea that'll work
so whenever a player disables it
in ther server script, do this code
what do i do now to make it work
local RS = game:GetService("ReplicatedStorage")
local radioEvent = RS:FindFirstChild("radio")
local playing = true
script.Parent.ProzimityPrompt.Triggered:Connect(function(player)
radioEvent:FireClient(player, (not playing))
end)
then in your local script
local RS = game:GetService("ReplicatedStorage")
local radioEvent = RS:FindFirstChild("radio")
radioEvent.OnClientEvent:Connect(function(playing)
if playing then
workspace["Radio model"].Sound.Volume = 0
return
end
workspace["Radio model"].Sound.Volume = 1
end)
that should work
ok one sec let me try to figure this out
ok
is this right?
its not working
is it easier if i stream this to u
@limpid sparrow
all good
is nothing happening?
i renamed all the scripts involved radio and the remote event radio so its easier for me
here let me show u everything
whats that script?
is this the local or server script?
oh okay
can you go to the view tab at the top of studio for me?
i figured as much
so thats called the output
its your best friend when debugging (fixing) a program
right now theres an error with the code
i misspelled Proximity
here ill send the server script again but fixed
i forgot to add a line anyway
local RS = game:GetService("ReplicatedStorage")
local radioEvent = RS:FindFirstChild("radio")
local playing = true
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
radioEvent:FireClient(player, (not playing))
playing = not playing
end)
there
that'll work for you
thats for the serverscript then?
yes
yippee!
um
can you join my game real quick