So I have the boolian called "AFK" in the player (game.Players.AFK) and I'm trying to make it change on click, it's a local script. I don't know what's wrong and nothing is producing errors.
local plr = game.Players.LocalPlayer function Down() if plr.AFK.Value == true then plr.AFK.Value = true script.Parent.Text = "Back" else script.Parent.Text = "Go afk" plr.AFK.Value = false end end script.Parent.MouseButton1Click:connect(Down)
Your problem is your logic is backwards:
local plr = game.Players.LocalPlayer function Down() if not plr.AFK.Value then --aka if plr.AFK.Value ~= true then plr.AFK.Value = true script.Parent.Text = "Back" else script.Parent.Text = "Go afk" plr.AFK.Value = false end end script.Parent.MouseButton1Click:connect(Down)
What the code was doing before was seeing that AFK.Value is true
, and then setting it to true
again!