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
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()