So I’ve been trying to detect if a player is typing so I can determine if they can fire the event or not, but for some reason the script does not seems to work, except for when I remove the “if not chat then” line any ideas?
game:GetService("UserInputService").InputBegan:connect(function(input, chat)
if not chat then
if Dropping.Value == true then
if input.KeyCode == Enum.KeyCode.X then
rEvent:FireServer('q',true)
print("w")
end;
if input.KeyCode == Enum.KeyCode.C then
rEvent:FireServer('Down',true)
print("e")
end;
end
end
end)
game:GetService("UserInputService").InputBegan:connect(function(input, Typing)
if not Typing then return end
if Dropping.Value == true then
if input.KeyCode == Enum.KeyCode.X then
rEvent:FireServer('q',true)
print("w")
end;
if input.KeyCode == Enum.KeyCode.C then
rEvent:FireServer('Down',true)
print("e")
end;
end
end
end)
game:GetService("UserInputService").InputBegan:connect(function(input, chat)
if chat then return end
if Dropping.Value == true then
if input.KeyCode == Enum.KeyCode.X then
rEvent:FireServer('q',true)
print("w")
end;
if input.KeyCode == Enum.KeyCode.C then
rEvent:FireServer('Down',true)
print("e")
end;
end
end)
game:GetService("UserInputService").InputBegan:connect(function(input, Typing)
if Typing then return end
if Dropping.Value == true then
if input.KeyCode == Enum.KeyCode.X then
rEvent:FireServer('q',true)
print("w")
end;
if input.KeyCode == Enum.KeyCode.C then
rEvent:FireServer('Down',true)
print("e")
end;
end
end
end)
Try this instead. I had a typo in a previous post of mine, sorry.
game:GetService("UserInputService").InputBegan:Connect(function(key, isTyping)
if isTyping then return end
if Dropping.Value == true then -- where is Dropping? do you have a variable for it above this part of the script?
key = key:lower()
if key == 'x' then
rEvent:FireServer('q',true) -- picking this up in a server script?
print("w")
elseif key == 'c' then
rEvent:FireServer('Down',true) -- assuming you're picking this up in a server script too?
print("e")
end
end
end)