Here is the code:
`-- In a LocalScript in StarterGui:`
`-- Create ScreenGui`
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = script.Parent
`-- Create TextButton`
local textButton = Instance.new("TextButton")
textButton.Parent = screenGui
textButton.Position = UDim2.new(0, 25, 0, 50)
textButton.Size = UDim2.new(0, 150, 0, 50)
textButton.BackgroundColor3 = BrickColor.White().Color
textButton.Text = "Synch"
textButton.Parent.Enabled = false
`--First use`
textButton.MouseButton1Down:connect(function()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
if textButton.Parent.Enabled == true then
textButton.Text = "De-Synch"
end
end)
`--Second use`
textButton.MouseButton1Down
:connect(function()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
end)
So what I'm trying to do is for the Gui button to go from sync to de-sync and immobilize player then once you click de-sync it will give the player movement back
The code to go with it is stapled to a part that when touched makes the Gui enabled = true therefore making it say de-sync

1 comment
Here is how I fixed it/ answer if anyone has a similar problem