I've encountered an extremely odd issue with my code. For some reason, my code is being executed despite conditions I've put in. Below is some sample code that demonstrates my issue (Local script)
game:GetService("UserInputService").InputBegan:connect(function(input,gp) local f = true if f == true then f = false print("I can eat peanut butter") end end)
Despite the conditions placed inside the if statement and the fact that variable f turns to false, the script still prints "I can eat peanut butter" no matter what. It is extremely odd. If anyone has any info about this or know how to deal with it, please comment.
f
should be at the top
local f = true game:GetService("UserInputService").InputBegan:Connect(function() -- Your not using them, so I'll remove them. if f == true then f = false print("I can eat peanut butter") end end)