Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Get rid of HumanoidController?

local ControllerService = game:GetService('ControllerService')

for key, value in pairs(ControllerService:GetChildren()) do 
    if value:IsA('HumanoidController') then 
        value:Destroy()
    end
end

The code above sadly does not work anymore due to roblox updates is there any other way I can do this now?

Thanks ~KIHeros

1 comment

0

Fixed it

1 answer

✓ Accepted answer

There is! There is an update that added player scripts. In one of the player scripts is a script that makes you able to control the player. Just delete that instead of the objects inside of the ControllerService.


We will use PlayerAdded to get rid of the controller script when they join the game:

game:GetService("Players").PlayerAdded:connect(function(plyr)
	local controls = plyr.PlayerScripts:FindFirstChild("ControlScript")
	if controls then
		controls:Destroy()
	end
end)


Hope it helps!




Notes

Just incase they get another update where they remove player scripts, I have made a better version of this:

local ControllerService = game:GetService('ControllerService')

game:GetService("Players").PlayerAdded:connect(function(plyr)
	local controls = plyr.PlayerScripts:FindFirstChild("ControlScript")
	if controls then
		controls:Destroy()
	else
		ControllerService.Instance:Destroy() --Something like that.
	end
end)

Remember that you don't have to remove controls when they join, all you need is to be able to find the player through :GetPlayerFromCharacter() or LocalPlayer.


Fixed the script

--LocalScript inside of StarterPlayer and StarterPlayerScripts
script.Parent:WaitForChild("ControlScript"):Destroy()

1 comment

0

As always you are the one that comes by and gives out the best and perfect answer it works! good job!

This discussion is preserved as it was. New answers, comments, and votes are closed.