✓ Accepted answer
Local Script (this change would be on the Client only)
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil and workspace:FindFirstChild(player.Name) ~= nil
local TextButton = script.Parent.Parent.Parent
LocalScript = player.Character.LocalScript
TextButton.Activated:Connect(function(onClick)
if LocalScript.Disabled == false then
LocalScript.Disabled = true
elseif LocalScript.Disabled == true then
LocalScript.Disabled = false
end
end)
ISSUES
A. Make sure that your variables are correctly named in your script (you defined TextButton, but used "Button" to connect the function)
B. Use Activated rather than MouseButton1Click since Activated works for all devices, not just computers
C. The LocalScript from StarterPlayerScripts will be parented under the player's Character, so that's the definition to index
D. Player Characters load before they are placed into the workspace, so you have to wait for it to be in the workspace before it is used in the script
E. Make sure that the TextButton is under the StarterGui in some way, unless you are directly parenting it to the PlayerGui via a Script.
2 comments
you have to make a script first and then paste it in and select it and click the lua changer thing and the community will help you fix it until it works.
I see. Thanks