FoxMulder Posted January 3, 2015 Share Posted January 3, 2015 Hello everyone, I was working on a premade LUA script of FPS and I found flashlight script, really nice However I can't make it work in my personal project. I used this part of the script which is completely correct: --Flashlight if window:KeyHit(Key.F) then self.sound.flashlight:Play() if self.flashlight:Hidden() then self.flashlight:Show() else self.flashlight:Hide() end end The flashlight works, the sound is correctly played, however when I hit again the F key the flashlight doesn't turn off but the light becomes brighter and brighter. Before After What am I missing ? Thank you again for your precious support ! Quote Link to comment Share on other sites More sharing options...
FoxMulder Posted January 4, 2015 Author Share Posted January 4, 2015 Anyone can help ?? Quote Link to comment Share on other sites More sharing options...
josk Posted January 4, 2015 Share Posted January 4, 2015 Check the part where you create the Flashlight. Looks like everytime you press F you are creating another flashlight. Quote Elite Cobra Squad Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 4, 2015 Share Posted January 4, 2015 The code you provided looks fine actually. My guess is, like Josk says, that there might be some code somewhere else that conflicts with the code you are currently showing. Quote Link to comment Share on other sites More sharing options...
FoxMulder Posted January 4, 2015 Author Share Posted January 4, 2015 Thank you guys, I'll check if there are other scripts conflicting! Quote Link to comment Share on other sites More sharing options...
FoxMulder Posted January 4, 2015 Author Share Posted January 4, 2015 I can't find any part of the flashlight script conflicting with other scripts... Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 4, 2015 Share Posted January 4, 2015 Can you send the project via pm? I will have a quick look. Also if you send it, remove assets that are nogt required for me to test the level. (Sound or large terrain textures for instance). Quote Link to comment Share on other sites More sharing options...
FoxMulder Posted January 4, 2015 Author Share Posted January 4, 2015 HI Aggror ! Thanks for your willingness I'll send you the code via pm 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.