I was making a Snake Game. For it to work I added a Local Script in the frame. The up and down works but the left and right didn't work.
The Local Script:
local chr = script.Parent.chr
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local plrmouse = plr:GetMouse()
plrmouse.KeyDown:Connect(function(key)
if (key:byte() == 20) then --20 = Left Key
if script.Parent.Visible == true then
if chr.Position == not UDim2.new(0, 0, 0, 0) then
chr.Position = chr.Position - UDim2.new(0, 30, 0, 0)
end
end
elseif (key:byte() == 19) then --19 = Right Key
if script.Parent.Visible == true then
chr.Position = chr.Position + UDim2.new(0, 30, 0, 0)
end
elseif (key:byte() == 18) then --18 = Down Key
if script.Parent.Visible == true then
chr.Position = chr.Position + UDim2.new(0, 0, 0, 30)
end
elseif (key:byte() == 17) then --17 = Up Key
if script.Parent.Visible == true then
if chr.Position == not UDim2.new(0, 0, 0, 0) then
chr.Position = chr.Position - UDim2.new(0, 0, 0, 30)
end
end
end
end)

2 comments
Thanks but it didn't help. The problem is still there
Never mind, I just had to change the keybinds from Up, Down, Left, Right to U, J, H, K