I have been trying to create a hold and release keybind that uses contextactionservice. I only get a result from both the client and server once the key is held down, as when the key is released, the client and server don’t print any result back.
--Client--
local function ImpactFistEMove(Name,State,Object)
if Name == "HoldAndRelease" and State == Enum.UserInputState.Begin then
if UIS:IsKeyDown(Enum.KeyCode.E) == true then
local HoldDownKey = UIS:IsKeyDown(Enum.KeyCode.E)
print("E Key held down")
ImpactRemote:FireServer(HoldDownKey)
if Name == "HoldAndRelease" and State == Enum.UserInputState.End then
if UIS:IsKeyDown(Enum.Keycode.E) == false then
print("E Key released")
HoldDownKey = UIS:IsKeyDown(Enum.KeyCode.E)
ImpactRemote:FireServer(HoldDownKey)
end
end
end
end
end
--Server--
ImpactRemote.OnServerEvent:Connect(function(Player,HoldDownKey)
local Character = Player.Character
if HoldDownKey == true then
print(HoldDownKey)
if HoldDownKey == false then
print(HoldDownKey)
end
end
end)
I’m trying to find out how to get the server to trigger a response whenever the ‘E’ key is released from the client