Hey, I just want to know if its possible to make it look like the character pressed a key. For example, if a green light only pops up if the player presses “E”, would it be possible to force roblox to think that the player pressed E without them actually pressing it.
Just use BindAction from contextactionservice. You would bind it every time the green light pops up and unbind it when it’s not there.
Here’s an example :
local contextactionservice = game:GetService("ContextActionService")
local function greenLight(action, inputState, inputObject)
if action == "GreenLight" then
if inputState == Enum.UserInputState.Begin then
-- code
end
end
local GreenLight = Instance.new("Frame")
GreenLight.Parent = PLAYERGUIANYWHERE
contextactionservice:BindAction("GreenLight", greenLight, false, Enum.KeyCode.E)
wait(1)
if GreenLight == nil then
contextactionservice:UnbindAction("GreenLight")
end