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

Why is this returning as nil?

Asked by 8 years ago

So i tried to use the Controller Service to remove the player's control so i made this script:

local controllerService = game:GetService("ControllerService")
local controller = controllerService:GetChildren()[1]
controller.Parent = nil --Removes control of the character.
wait(5)
controller.Parent = controllerService --Gives control back.

But when i try to use this, it says that controller is equal to nil. Am i doing something wrong here?

Answer this question