ExecuteFunction.OnClientInvoke = function()
local Connection: RBXScriptConnection
Connection = UserInputService.InputEnded:Connect(function(InputObject)
if InputObject.KeyCode == Enum.KeyCode.E then
Connection:Disconnect()
-- return true
else
-- return false
end
end)
task.wait(1)
-- return false
Connection:Disconnect()
end
so basically its a remote function which invokes the client and the client has to press E in a duration of time, and return the result to the server if the player has pressed E or not
I’m assuming you’re uncertain where and when to return the value?
hope it helps!
ExecuteFunction.OnClientInvoke = function()
local Connection: RBXScriptConnection
local DidRightInput = false
Connection = UserInputService.InputEnded:Connect(function(InputObject)
if InputObject.KeyCode == Enum.KeyCode.E then
Connection:Disconnect()
DidRightInput = true -- if desired Keycode!
end
end)
task.wait(1)
Connection:Disconnect()
return DidRightInput -- Return default value of false if player failed to provide a Keycode in time.
end