What do you want to achieve? I want to make it so that when a flashlight is (fake) equipped using a proximity prompt, two scripts for a F to Flashlight type system to enable
What is the issue? When the proximity prompt is triggered and the scripts enabled, the code in the scripts wont work? I tried them without having them enabled by script and they worked?
What solutions have you tried so far? I haven’t tried any yet because i literally dont have any idea why this happened
This is the script that enables the flashlight script:
For UserInputService, I think you need a second parameter called “gameprocessed”. I’m pretty sure this just checks if the game processed your input. For your local script, the UIS function should be set up like this:
UserInputService.InputBegan:Connect(function(input,gameprocess)
if not gameprocess then
if input.KeyCode == Enum.KeyCode.F then
--code here
end
end
end)
Your code looks correct, can you check output to see if any errors show up? If there are any, list the errors. If there aren’t any, check your scripts for any typos forgot to type in a line of code.
For the flashlight script, I’m assuming you want the player to pick up some type of object that unlocks a flashlight which can be activated by pressing F?
there are no errors. Yes its a flashlight script and when a equip prox prompt is triggered i want the flashlight scripts to enable because its 2 different systems. This is because im making a different custom made inventory. so the flashlight cant be a tool with a flashlight system in it. The flashlight system is a free model tho so if you wanna check the original code or something its called “Press F for Flashlight” by Tomatothebob
I’m not at my PC but I can try writing a flashlight system that works when I get back. In the meantime you can try using “print(message)” to see if code runs. Basically put “print(message)” where the you want your other functions to run. If you see the message you put in the print then the code should run. If you don’t see the message you put in “print” then that means it didn’t run.
Maybe what you can do is have a variable to keep track whether or not you have collected the flashlight. When you collect the flashlight, you can set the variable to true to indicate that you have collected it. You can make the code you have currently only run when the variable is true. That way you can keep the scripts on all of the time and you can only activate the flashlight once you unlocked it.