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

Why wont this disable player controls?

Asked by 8 years ago

so first i have the function,

controllers = {}

function removeControl()
    local PressedKeys = game:GetService("UserInputService"):GetKeysPressed()
    repeat wait() until not next(PressedKeys) -- This should work! :D
    for i, controller in pairs(game:GetService("ControllerService"):GetChildren()) do
        table.insert(controllers, controller)
        controller.Parent = nil 
        print("function done")
    end
end

then i have the activators

local PressedKeys = game:GetService("UserInputService"):GetKeysPressed()
    if not next(PressedKeys) then
        removeControl()
        game.Players.LocalPlayer.Character.Human.WalkToPoint = Vector3.new(24.4, 0.3, -14.2)
    else repeat wait() until not next(PressedKeys)
        removeControl()
        game.Players.LocalPlayer.Character.Human.WalkToPoint = Vector3.new(24.4, 0.3, -14.2)

for some reason the player can still move their character and cancel the path

0
Dude, ive tried to do the same thing and it doesnt work, the roblox wiki sux... I found a way to do it though. Go into player STarterScripts and copy the control script. Paste it into the backpack and then you can disable it and enable it as u plz. Dont forget to disable the on in starterscripts koolkid8099 705 — 8y

Answer this question