plr = game.Players.LocalPlayer
mouse = plr:getMouse()
function q(key)
if key == q then
plr.Character.Humanoid.Health = 0
end
end
mouse.KeyDown:connect(q)
When you press q you're supposed to die. But it doesn't work, any help?
plr = game.Players.LocalPlayer
mouse = plr:getMouse()
function q(key)
if key == q then
plr.Character.Humanoid.Health = 0
end
end
mouse.KeyDown:connect(q)
When you press q you're supposed to die. But it doesn't work, any help?
The KeyDown event returns a string, containing the key you pressed. I'll repeat that, a string. You have to compare the key with a string for this to work, and I suggest using string.lower while comparing the key.
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
function q(key)
if key:lower() == "q" then
plr.Character.Humanoid.Health = 0
end
end
mouse.KeyDown:connect(q)
This discussion is preserved as it was. New answers, comments, and votes are closed.