Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

LocalScript problem, its working for all players help?

Asked by 6 years ago

LocalScript but work for all, i maked a audio visualizer in button its localscript https://imgur.com/a/1y2G4 but when other player press button that change to all players

BUTTON CODE :

sound = workspace.Sound
function onButtonClicked()
local ContentProvider = game:GetService("ContentProvider")
 local Audio = "http://www.roblox.com/asset/?id=300647220"
 sound.SoundId = Audio
 sound:Play()
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

And i dont know im just new to LUA scripting but anyways is there is anyway to fix it?

3 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Solution: 1. FilteringEnabled, obviously. afaik sound changes does not replicate to server nor other clients when FilteringEnabled is enabled and so is an option called "RespectFilteringEnabled" in SoundService.

  1. Instead, move the sound object to the player's gui or simply enough inside the button. That way it will only play to the player that has it, instead of the whole workspace.
0
Do i need to turn on RespectFiltering... and Filterting? NathanAdhitya TheXasLTU 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Not helped when somebudy press on button itss still change to all

0
Filtering is disabled in my game becouse when its enabled its not works TheXasLTU 0 — 6y
Log in to vote
0
Answered by
JellyYn 70
6 years ago
Edited 6 years ago

In my opinion, it's easier to use a :Connect(function(Open) instead of function whenClicked()

The way I do things like this is:

local sound = script.Parent,Sound -- sound is now in the button with the local script
local button = script.Parent
playing = false

button.MouseButton1Click:Connect(function(Play)
    if playing == false then
        sound:Play()
        playing = true
    end
end)
0
Also, just put the sound id in the sound object, you don't need a script to do it for you. It is a lot more work. JellyYn 70 — 6y

Answer this question