I have 2 bricks that play audio once
local CD = script.Parent.ClickDetector local Part = script.Parent local Sound = script.Parent.Sound game.Players.PlayerAdded:Connect(function(plr) local HasClicked = Instance.new("BoolValue") HasClicked.Name = 'HasClicked' HasClicked.Parent = plr end) CD.MouseClick:Connect(function(player) if player.HasClicked.Value == false then Sound.Playing = true player.HasClicked.Value = true else print('No you have clicked this') end end)
And if I click the 1 brick that plays audio the other one does not
local CD = script.Parent.ClickDetector local Part = script.Parent local Sound = script.Parent.Sound local Clicked = {} game.Players.PlayerAdded:Connect(function(plr) Clicked[plr.UserId] = false end) CD.MouseClick:Connect(function(plr) if Clicked[plr.UserId] == false then Clicked[plr.UserId] = true Sound:Play() else print("You have already clicked ...") end end)