I want a type of npc to play different sounds when you get near to it. I am using this script as a base. function init() self.npcSounds = config.getParameter("npcSounds", {}) self.soundTimer = 0 end function update(dt) self.soundTimer = math.max(0, self.soundTimer - dt) if self.soundTimer == 0 then local players = world.entityQuery(object.position(), config.getParameter("soundRadius"), { includedTypes = {"player"}, boundMode = "CollisionArea" }) if #players > 0 and #self.npcSounds > 0 then object.say(self.npcSounds[math.random(1, #self.npcSounds)]) self.soundTimer = config.getParameter("soundCooldown") end end end