What I want to do is use the # keys on the keyboard to trigger certain scripts. (Preferably 2 in this case)
local mouse = game.Players.LocalPlayer:GetMouse()
local emp = false
function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
mouse.KeyDown:connect(function (key) -- Run function
if key == "2" then <---[[PROBLEM RIGHT HERE. I want this to be 2, it works with "q", but I need numbers, not letters]]
emp = true
print("EMPon")
local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
player.EMPon = true
if player.EMPon == true then
EMPvictim = player.EMPvictim
repeat wait()
until EMPvictim.Value ~= nil
victim = game.Players:FindFirstChild(""..EMPvictim.Value)
player.PlayerGui.EMP.Adornee = victim
end
end
end)

4 comments
How would I script that using the script I wrote? InputBegan look's simpler.
HOLD IT I forgot something.
Not sure if it would work 100% tho. Give it a shot.
Nope. Doesn't work at all :/