Player control is disabled when I disable the local script in which I disable/enable player control

Where’s the logic in that? Is it, in fact, a bug?
dfgrr

local plr = game.Players.LocalPlayer
local Controls = require(plr.PlayerScripts.PlayerModule):GetControls()

Controls:Disable()
Controls:Enable()

If run this script, everything will be okay.

But add disabled scripts, and the character can no longer move.

local plr = game.Players.LocalPlayer
local Controls = require(plr.PlayerScripts.PlayerModule):GetControls()

Controls:Disable()
Controls:Enable()

script.Disabled = true

I have a script where the player’s camera moves from point A to point B, and this move is needed only on the first start (transition from the lobby to the character)

For this reason, after moving the camera, I want to disable the script (or delete it), because it is no longer needed.

if u want the script to be deleted then put script:destroy

There is a solution to this here:

It doesn’t work, I checked

I read that thread and found another way

local plr = game.Players.LocalPlayer
task.wait(1)

local ContextActionService = game:GetService("ContextActionService")

ContextActionService:BindAction("qq",
	function()
		return Enum.ContextActionResult.Sink
	end,
	false,
	unpack(Enum.PlayerActions:GetEnumItems())
)
ContextActionService:UnbindAction("qq")

script.Disabled = true

I don’t understand what Enum.ContextActionResult.Sink is, but the code works.

1 Like