Hello im try to make a scanner thing, so i try to make player touch it play sound wait 3 seconds then repeat the process script:
Touched:connect(function(player) script.Parent.Sound:Play()
end
So what I'm assuming is you want a sound to play whenever a player touches and repeat it twice?
script.Parent.Touched:Connect(function(player) --When the part is touched connect to a function local hit = player.Parent:FindFirstChild("Humanoid") --Find the player's character local db = false --Create a debounce if hit then --If the object that touched it is a player then if not db then script.Parent.Sound:Play() --Play the sound sound.Ended:Wait() --Wait for the sound to end wait(3) script.Parent.Sound:Play() sound.Ended:Wait() db = true end end end)
Put this in a LocalScript
. If you want it to play for everyone or for certain people then learn about RemoteEvent
here: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events