So the player is meant to give a response in a certain amount of time; but for some reason this isnt quite working the way Id expect it to.
"Chat" = nil
It waits for my response and everything (unless timeout) but Chat always comes up a nil. Help?
I understand its returning to fast but, how can I slow that down to get the correct chatted response?
function JARVIS:WaitForReply(Player)
local Con
local Chat = ""
delay(12,function()
Con:disconnect()
end)
Con = Player.Chatted:connect(function(Message)
Chat = Message --> Message is fine
end)
Player.Chatted:wait()
Con:disconnect()
print(Chat) --> nil value
return Chat
end

8 comments
Chat = Message, you never define
C, therefore, it is nilIt was C = JARVIS:RemoveSlashE(Message) for anyone wanting to know. :)
Why is your chatted event inside a function? Bad practice.
The reason its inside a function is because I dont need it often. Aka the reason: Con:disconnect() is there.
disconnect is not a thing, but Disconnect() is.
disconnect IS a thing; go try it
^
disconnectis a "thing", but it was deprecated in favor ofDisconnect.^^^ there we go