- What do you want to achieve? Keep it simple and clear!
The title says its all. Im trying to recreate the deprecated mouse function “Mouse.KeyDown()”.
- What is the issue? Include screenshots / videos if possible!
(I recently learnt OOP so im not quite a pro with it yet. So sorry if this is an easy fix)
I can create the signal n everything. But the problem occurs when i want to connect a callback to the Signal
Code for creating a new signal(Just a returned UserInput Signal)
Signal module
local module = {}
function module.new()
local self = setmetatable(module, {})
self.Signal = game:GetService("UserInputService").InputBegan
return self
end
return module
Main module
local module = {}
local SignalModule = require(script:WaitForChild("Signal"))
function module.new()
local self = setmetatable(module, {})
self.Signal = SignalModule.new()
return self
end
function module:Connect(Func)
self.Signal:Connect(Func) -- // Problem occurs here. Since the "Func" is a callback i cant access the InputObject?.
end
How would i be able to connect the first arg(Callback) AND access the InputObject returned from UserInputService??