So I have a script that teleports the player to Cayo Perico via a cutscene that plays. I added a frontend sound that plays when you step in the circle and it tells you to “Press E to travel to Cayo Perico”. Everytime I’m in the circle, the sound keeps dinging until I step out of it. Below I’ll leave the actual code that plays, and would like to make it play only once when the player steps in. Thanks.
local closestLocationCoords = GetFromCoordinate(ClosestTeleportLocation)
local distance = #(PedCoordinates - closestLocationCoords)
if distance > 20.0 then
IsInSideTeleportLocation = false
waitTime = 500
else
waitTime = 0
if distance < (Config.Marker.Size * Config.ActivationDistanceScaler) then
DisplayTeleportHelpText()
PlaySoundFrontend(-1, "INFO", "HUD_FRONTEND_DEFAULT_SOUNDSET", -1)
end
ShowMarker()
end
end
end
end
)