local ContextActionService = game:GetService("ContextActionService") local function EnterDoor(inputState) if inputState == Enum.UserInputState.Begin then local DoorDistance = (workspace.Door1.Zone.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude if DoorDistance <= 50 then print ("you went in the door yay") end end end ContextActionService:BindAction("GoInDoor", EnterDoor, true,"e")
it doesn't print the thing when i press the button and i don't know why. i don't get any errors when i run it.
Revised Local Script
local ContextActionService = game:GetService("ContextActionService") local function EnterDoor(actionName, inputState, inputObj) if inputState == Enum.UserInputState.Begin then local DoorDistance = (workspace.Door1.Zone.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude if DoorDistance <= 50 then print ("you went in the door yay") end end end ContextActionService:BindAction("GoInDoor", EnterDoor, true, Enum.KeyCode.E)
EDITS
A. You need to alter "e" to the actual Enum KeyCode
B. The function for the ContextActionService contains three parameters, the first of which is the action's name, which you had tried to define as the inputstate.