Enabling Controls with GUI Button?

Hi, I’ve come to post is it possible to enable a players controls with just one GUI Button?

I’m not a big programmer, but I think it might be possible.

Make a GUI button mouse click event then:
https://devforum.roblox.com/t/disabling-character-controls/498430

1 Like
local players = game:GetService("Players")
local player = players.LocalPlayer
local playerScripts = player:WaitForChild("PlayerScripts")
local playerModule = playerScripts:WaitForChild("PlayerModule")
local controlsModule = require(playerModule)
local playerControls = controlsModule:GetControls()

local button = script.Parent

local toggle = true

button.MouseButton1Click:Connect(function()
	toggle = not toggle
	if toggle then
		playerControls:Enable()
	elseif not toggle then
		playerControls:Disable()
	end
end)

repro.rbxm (3.4 KB)