Expanding on my PM script, I made a button in a ScreenGUI that changes whether a person can received PMs or not. However, when the button is clicked, the value does not change and neither does the text. The output tells me nothing. Here is the script:
while true do if game.Players.LocalPlayer:FindFirstChild("PM") == nil then f = Instance.new("BoolValue") f.Name = "PM" f.Value = true f.Parent = game.Players.LocalPlayer end wait(0.2) end function onClick() print ("hi") if script.Parent.on.Value == false then script.Parent.on.Value = true game.Players.LocalPlayer.PM.Value = true script.Parent.Text = "PMs Allowed" elseif script.Parent.on.Value == true then script.Parent.on.Value = false game.Players.LocalPlayer.PM.Value = false script.Parent.Text = "PMs Disallowed" end end script.Parent.MouseButton1Down:connect(onClick)
Can anyone help? The print doesn't show in the output either.
now, I'm not sure if this'll fix it, but it's easier to use one line for a function
while true do if game.Players.LocalPlayer:FindFirstChild("PM") == nil then f = Instance.new("BoolValue") f.Name = "PM" f.Value = true f.Parent = game.Players.LocalPlayer end wait(0.2) end script.Parent.MouseButton1Down:connect(function() --Instead of having 2 lines, we can make it one print ("hi") if script.Parent.on.Value == false then script.Parent.on.Value = true game.Players.LocalPlayer.PM.Value = true script.Parent.Text = "PMs Allowed" elseif script.Parent.on.Value == true then script.Parent.on.Value = false game.Players.LocalPlayer.PM.Value = false script.Parent.Text = "PMs Disallowed" end end)