✓ Accepted answer
First of all, try to make ":Connect" into ":connect", and maybe that will help.
Second of all, use
if KeyDown:byte() == 19 then
on those things instead of
if KeyDown == 19 then
It seems to work for me, I used a script in a game I'm making with that sort of idea:
local mouse = game.Players.LocalPlayer:GetMouse()
function onkeyDown(key)
if key:byte() == 19 then
if script.Parent.CurrentOption.Value == "Fight" then
script.Parent.CurrentOption.Value = "Act"
script.Parent.Fight.Image = "rbxgameasset://Images/spr_fightbt_center_0"
script.Parent.Act.Image = "rbxgameasset://Images/spr_actbt_center_1"
script.Parent.Act.Heart.Visible = true
script.Parent.Fight.Heart.Visible = false
elseif script.Parent.CurrentOption.Value == "Act" then
script.Parent.CurrentOption.Value = "Item"
script.Parent.Act.Image = "rbxgameasset://Images/spr_actbt_center_0"
script.Parent.Item.Image = "rbxgameasset://Images/spr_itembt_1"
script.Parent.Item.Heart.Visible = true
script.Parent.Act.Heart.Visible = false
elseif script.Parent.CurrentOption.Value == "Item" then
script.Parent.CurrentOption.Value = "Mercy"
script.Parent.Item.Image = "rbxgameasset://Images/spr_itembt_0"
script.Parent.Mercy.Image = "rbxgameasset://Images/spr_sparebt_1"
script.Parent.Mercy.Heart.Visible = true
script.Parent.Item.Heart.Visible = false
elseif script.Parent.CurrentOption.Value == "Mercy" then
script.Parent.CurrentOption.Value = "Fight"
script.Parent.Mercy.Image = "rbxgameasset://Images/spr_sparebt_0"
script.Parent.Fight.Image = "rbxgameasset://Images/spr_fightbt_center_1"
script.Parent.Fight.Heart.Visible = true
script.Parent.Mercy.Heart.Visible = false
end
end
end
mouse.KeyDown:connect(onkeyDown)
1 comment
KeyDown is deprecated.