How to disable a character controller

Hello, I am making a surrendering/capturing script. I am setting up so when you capture someone you can say “/cp [player] follow” to have them follow you, but i need to disable the character controller.

I have no clue how to do this, if you know then please tell me.

Server Side Script :

local Teams = game:GetService("Teams")
local Captured = {}
local Surrenderd = {}
local Surrender = game.ReplicatedStorage.Surrender
local Capturing = game.ReplicatedStorage.Capture
local Stage1 = game.ReplicatedStorage.CapturedLABEL
local stage1 = game.ReplicatedStorage.SurrenderedLABEL
local turnonoff = game.ReplicatedStorage.turnon

Surrender.OnServerEvent:Connect(function(player)
	for p,s in pairs(Captured) do
		if p == player then
		else
			Surrenderd[player] = true
			local Head = player.Character:FindFirstChild("Head")

			local Cloned1 = stage1:Clone()
			local Cloned2 = Stage1:Clone()
			Cloned1.Parent = Head
			Cloned2.Parent = Head
		end
	end
	
	
	if Captured.Length == nil then
		Surrenderd[player] = true
		local Head = player.Character:FindFirstChild("Head")

		local Cloned1 = stage1:Clone()
		local Cloned2 = Stage1:Clone()
		Cloned1.Parent = Head
		Cloned2.Parent = Head
	end
	
end)

Capturing.OnServerEvent:Connect(function(player, CapturedPlayer)
	for s,d in pairs(Surrenderd) do
		if s == CapturedPlayer then
			Surrenderd[CapturedPlayer] = nil
			Captured[CapturedPlayer] = player
			local Head = CapturedPlayer.Character:FindFirstChild("Head")
			local STAGE1 = Head.CapturedLABEL
			local STAGE2 = Head.SurrenderedLABEL
			if STAGE1 and STAGE2 then
				STAGE1:Destroy()
				STAGE2:Destroy()
			end
		end
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		for CapturedPlayer, PlayerThatCaptured in pairs(Captured) do
			if player == CapturedPlayer then
				--do nothing
			elseif player == PlayerThatCaptured then
				if msg:match("/cp") then
					local words = string.split(msg, " ")
					local cp = words[2]
					local cmmd = words[3]
					if cmmd == "follow" or cmmd == "Follow" and cp == game.Players:GetFistChild(CapturedPlayer) then
						--CapturedPlayer.Character.Humanoid
						turnonoff:FireClient(CapturedPlayer, "off")
					end
					if cmmd == "endfollow" or cmmd == "Endfollow" and cp == game.Players:GetFistChild(CapturedPlayer)  then
						turnonoff:FireClient(CapturedPlayer, "on")
					end
				end
			end
		end
	end)
end)

Client Side :

-- i need help with the client side 

The use of profanity is not allowed in public topics.

Yes, i just relized that was there i just changed it

Put this in client side script

local Controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
Controls:Disable()

And do this to re-enable it

Controls:Enable()

I have looked at other posts and tried it, it dosent work.

player.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable

might be a solution?

2 Likes

I am currently testing something, i will mark as a sulotion if this does not work, and that works. Thank you

1 Like

Thank you, i had to change it a little bit because i needed to move back and forth so heres the part of that script.

Thanks so mutch

					local words = string.split(msg, " ")
					local cp = words[2]
					local cmmd = words[3]
					if cmmd == "follow" or cmmd == "Follow" and cp == game.Players:GetFistChild(CapturedPlayer) then
						CapturedPlayer.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
						CapturedPlayer.DevComputerMovementMode = Enum.DevComputerMovementMode.Scriptable
						blue = true
						while blue do
							CapturedPlayer.Character.Humanoid.WalkToPoint(PlayerThatCaptured.Character.HumanoidRootPart.Position)
						end
					end
					if cmmd == "endfollow" or cmmd == "Endfollow" and cp == game.Players:GetFistChild(CapturedPlayer)  then
						blue = false
						CapturedPlayer.DevTouchMovementMode = Enum.DevTouchMovementMode.UserChoice
						CapturedPlayer.DevComputerMovementMode = Enum.DevComputerMovementMode.UserChoice
					end
1 Like