Currently this code does not work as intended. It works sometimes, but only while the player is either moving or standing in the perfect position for some reason. I believe it is because the action is only able to work when touched is fired simulateniously to the E key being pressed. Any advice?
CCCP.Touched:Connect(function(HP)
if HP.Parent:FindFirstChild("Humanoid") then
print("Touched")
CAS:BindAction("ChangeColor", partChange, true, Enum.KeyCode.E)
end
end)
CCCP.TouchEnded:Connect(function(HP)
if HP.Parent:FindFirstChild("Humanoid") then
CAS:UnbindAction("ChangeColor")
end
end)
From my personal experience, touched events are unreliable: I never use them. I doubt this has anything to do with ContextActionService. I advise looking at other methods. ZonePlus is a module that could be useful for you.
Currently your code will bind and unbind for any humanoid part that touches it, consider tracking only one part, or implementing some sort of debounce.
And no, Touched events are not “unreliable”, if they were, that’d be a bug with the physics engine, and you’d probably be walking through solid walls.