Cannot Move Character in Studio

Hey fellow developers!
I was just using Studio for the first time today and I am unable to move in Play Mode. The output shows the following error:

ContextActionService:BindAction can only be called from a local script

I am unsure why this is happening, as I currently have no scripts in my game. It also seems to occur in all other games (and templates) when I try to enter Play Mode. This error prevents my character from being able to move at all, rendering Studio useless for the time being.

I have tried closing Studio, rebooting my computer, and Googling my issue, but to no avail. Is there something simple that I’m missing, or might I need to reinstall my download of Studio? Thanks for your help!

2 Likes

Could it be possible that you downloaded a malicious plugin of some sort? If not, you could try starting the simulation, copying/pasting the Core/PlayerScripts to StarterPlayerScripts, then stop the simulation to see where the issue could lie?

2 Likes

Use Ctrl+Shift+F then search for ContextActionService inside all the scripts.

Edit: Sorry for replying to the wrong person.

2 Likes

I haven’t downloaded any plugins in a long time, so I’m pretty sure it’s something else.

I tried moving all of the player scripts to StarterPlayerScripts, but the issue still persists.

I do not have any scripts in some games, like an empty baseplate, but the issue occurs anyway. Ctrl+Shift+F yields nothing, unfortunately.

I should’ve clarified more whoops, did you copy the PlayerScripts inside the Player object? Then parented them somewhere else to look at? (You are capable of checking those scripts while still running the simulation) There should be some sort of ContextActionService used inside those Player Scripts as IEnforce mentioned earlier, preferably where the main Controls are handled?

1 Like

Edited:
I am unsure where the error is occurring, but ContextActionService:BindAction seems to be used in the keyboard control module for movement. Could it be erroring because it’s in a modulescript?

Here are the lines that seem to be related.
ContextActionService:BindActionAtPriority("moveForwardAction", handleMoveForward, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterForward)
    ContextActionService:BindActionAtPriority("moveBackwardAction", handleMoveBackward, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterBackward)
    ContextActionService:BindActionAtPriority("moveLeftAction", handleMoveLeft, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterLeft)
    ContextActionService:BindActionAtPriority("moveRightAction", handleMoveRight, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterRight)
    ContextActionService:BindActionAtPriority("jumpAction", handleJumpAction, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterJump)

Let me know if it would be helpful to see the full script.

I don’t believe it depends on the type of script it fires on, either Local or Module (Module should accessed from both the server & client?) can work fine

Does it show the line number where the error persists from?

1 Like

Here is the output:

You said you haven’t added in any scripts at all, correct? If you’re able to, can you click the blue text? If it says “Source not available”, try & find where Line 142 may lie in that Control Module

1 Like

Line 142 is

self.moveVector = ZERO_VECTOR3

I do not think that it is causing the issue.

Edit: Just checked all of the movement scripts, and none of them have ContextActionService in line 142. Could it be something else causing the error?

Strange, I went ahead on Studio & the only thing that I could possibly break down is this function here:

function Keyboard:ConnectFocusEventListeners()
	local function onFocusReleased()
		self.moveVector = ZERO_VECTOR3
		self.forwardValue  = 0
		self.backwardValue = 0
		self.leftValue = 0
		self.rightValue = 0
		self.jumpRequested = false
		self:UpdateJump()
	end

	local function onTextFocusGained(textboxFocused)
		self.jumpRequested = false
		self:UpdateJump()
	end

	self.textFocusReleasedConn = UserInputService.TextBoxFocusReleased:Connect(onFocusReleased)
	self.textFocusGainedConn = UserInputService.TextBoxFocused:Connect(onTextFocusGained)
	self.windowFocusReleasedConn = UserInputService.WindowFocused:Connect(onFocusReleased)
end

& the error says that it needs to be called from a LocalScript? Which I find strange (I tried it and it worked fine for me)

The last thing I’d recommend is contacting @Bug-Support about this strange occurrence if all else fails, I’m outta ideas at this point sadly

1 Like

That’s odd. I’m going to be away from my computer for a couple of hours, so I’ll reboot it again and see if it works when I return. Messaging @Bug-Support seems to be a valid alternative if I can’t get this to fix itself. Thank you so much for your help!


Edit: So disabling all of my plugins and re-enabling them again has fixed the issue. I can’t believe I didn’t try that sooner. :man_facepalming:

2 Likes

Ah I see, that was a weird situation though if you had to re-enable your plugins

Glad you fixed it though either way!

2 Likes