Help wtih ContextActionService

Hello everyone,

I am trying to use ContextActionService to detect input. However, it doesn’t seem to be working and I’m not sure why. Here’s the code:

local CAS = game:GetService("ContextActionService")

local function Thing(a, is, io)
    -- at this point i gave up and just tried printing 
    -- something but it didn't print
	print("used")
end

CAS:BindAction("lhajhfl", Thing, false, Enum.UserInputType.MouseButton1)

Here’s the hierarchy:
image

Thanks for your help.

1 Like

Of course it doesn’t work because local scripts will only work if it’s parented inside a player’s character model or in StarerScripts.

1 Like

oh i didn’t know that; i’ll put it in characterscripts.

1 Like

You could put it under StarterScripts, which works as well.

1 Like

ok it works thanks for the help

1 Like