Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

LocalScript problem, its working for all players help?

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

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.

  2. 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.

1 comment

0

Do i need to turn on RespectFiltering... and Filterting? NathanAdhitya

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

1 comment

0

Filtering is disabled in my game becouse when its enabled its not works

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)

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.