Still have questions? Join our Discord server and get real time help.
0

# How To Make Sound Play Once In A Block?

I am new here so forgive me if I am doing anything wrong. Below is a script so when you touch a block it plays music. The script is very glitchy when someone is standing on the block when afk , it cuts the music and keeps replaying,how do I fix this.

Sorry if my explanation is all over the place.

local sound = Instance.new("Sound", Workspace)
sound.Pitch = 1
sound.SoundId = "rbxassetid://902587196"
sound.Volume = 1
sound.Looped = false -- If you want the song to repeat after the song is done

script.Parent.Touched:connect(function()
sound:play()
end)

0
Thank you man. PhacYouBeech 3 — 2mo

0

Just added a bool so that once its played it wont play again.

local sound = Instance.new("Sound", Workspace)
sound.Pitch = 1
sound.SoundId = "rbxassetid://902587196"
sound.Volume = 1
sound.Looped = false -- If you want the song to repeat after the song is done
local playonce = false

script.Parent.Touched:Connect(function()
if not playonce then
playonce = true
sound:play()
end
end)

1
Thank you lol PhacYouBeech 3 — 2mo