Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

i tried this script out and when i clicked f nothing happened what am i doing wrong?

Asked by 5 years ago
Edited 5 years ago
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)
0
I put the code in a code block and fixed the indentation. TheeDeathCaster 2368 — 5y
0
Why did you put it back it how it was prior? TheeDeathCaster 2368 — 5y
0
im new to this i did not know how to use the lua edit thingy Six_Chain 0 — 5y
0
wdym by you put the code in a code block which code and how to put code's in code block's Six_Chain 0 — 5y
0
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 TheeDeathCaster 2368 — 5y

1 answer

Log in to vote
2
Answered by 5 years ago
Edited 5 years ago

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.

Ad

Answer this question