Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Get rid of HumanoidController?

Asked by
Hero_ic 502 Moderation Voter
9 years ago
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

0
Fixed it EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
2
Answered by 9 years ago

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()
0
As always you are the one that comes by and gives out the best and perfect answer it works! good job! Hero_ic 502 — 9y
Ad

Answer this question