Sargeant12344 Posted May 30, 2016 Share Posted May 30, 2016 I'm trying to make a heart flatlining sound and edited my respawn trigger and FPS Player Script, however when I try to test the script, no sound plays. Rather than post the whole FPS Player script I only posted the used bits. --Load shared sounds self.sound={}--table to store sound in self.sound.flashlight=Sound:Load("Sound/Player/flashlight_02_on.wav") self.sound.damage={} self.sound.damage[1]=Sound:Load("Sound/Impact/body_punch_03.wav") self.sound.damage[2]=Sound:Load("Sound/Impact/body_punch_04.wav") self.sound.pickupweapon=Sound:Load("Sound/Player/pickupammo.wav") self.sound.footsteps={} self.sound.footsteps.concrete={} self.sound.footsteps.concrete.step={} self.sound.footsteps.concrete.step[1] = Sound:Load("Sound/Footsteps/Concrete/step1.wav") self.sound.footsteps.concrete.step[2] = Sound:Load("Sound/Footsteps/Concrete/step2.wav") self.sound.footsteps.concrete.step[3] = Sound:Load("Sound/Footsteps/Concrete/step3.wav") self.sound.footsteps.concrete.step[4] = Sound:Load("Sound/Footsteps/Concrete/step4.wav") self.sound.footsteps.concrete.jump = Sound:Load("Sound/Footsteps/Concrete/jump.wav") self.sound.music={} self.sound.music = Sound:Load("Sound/Music/Heart") self.bloodoverlay={} self.entity:SetPickMode(0) Script.heartFlatlining = false function Script:HeartFlatlining() if script.heartFlatlining == true then self.sound.damage[math.random(#self.sound.damage)]:Play() end end Script.respawnPoint = "" --entity "Respawn point" function Script:Collision(entity, position, normal, speed) if(entity:GetKeyValue("name") == "Player") then spawnPos = self.respawnPoint:GetPosition() entity:SetPosition(spawnPos) spawnRot = self.respawnPoint:GetRotation() entity.script.camRotation = spawnRot entity.script.heartFlatlining = true else entity:Release() end end Thanks Quote Link to comment Share on other sites More sharing options...
Jazz Posted May 30, 2016 Share Posted May 30, 2016 if script.heartFlatlining == true then It is declared with Script.heartFlatlining so you access it with self.heartFlatlining within the same script. if self.heartFlatlining == true then Quote --- Scott Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060 Link to comment Share on other sites More sharing options...
Sargeant12344 Posted May 30, 2016 Author Share Posted May 30, 2016 Okay Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.