local repatore = game:WaitForChild("ReplicatedStorage")
local Remote = repatore:WaitForChild("iceStart")
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
cool = true
Mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "f" then
if cool == true then return end
cool = false
print("Worked")
wait(5)
end
end)
COMMUNITY QUESTION
i tried this script out and when i clicked f nothing happened what am i doing wrong?
1 answer
KeyDown is deprecated, you will need to use the UIS (UserInputService) instead.
local repatore = game:WaitForChild("ReplicatedStorage")
local Remote = repatore:WaitForChild("iceStart")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cool = true
game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F then
if cool == false then return end
cool = false
print("Worked")
wait(5)
cool = true
end
end)
Also, assuming "cool" is a debounce, you will want it to function as above in the script (reversing the bool positions), since otherwise, having defined "cool" as true to begin with, the script will never run past the "return end" line.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
I put the code in a code block and fixed the indentation.
Why did you put it back it how it was prior?
im new to this i did not know how to use the lua edit thingy
wdym by you put the code in a code block which code and how to put code's in code block's
It's cool; I recommend checking this out for future reference. https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site