Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Use chatted event to disable a gui/textbutton. Help?

Asked by 5 years ago

I've asked this before but I wanted to change it up a little. If a player is on a certain team and says a specific word it should disable this gui/textbutton for everyone else this is the server script

game.Players.PlayerAdded:Connect(function(player)
    if player.TeamColor == BrickColor.new("Earth green") then
        player.Chatted:Connect(function(msg)
        if msg == "DisableBall" then
        game.StarterGui:WaitForChild("ScreenGui").Spawn.TextButton.Text = "Disabled"
        game.StarterGui.ScreenGui.Spawn.TextButton.LocalScript.Disabled = true
        game.StarterGui.ScreenGui.Spawn.TextButton.BackgroundColor3 = Color3.new(170,0,0)
            game.ReplicatedStorage.No:FireAllClients() 
            end
        end)
    end
end)

This is the local script

local players = game.Players.LocalPlayer
game.ReplicatedStorage.No.OnClientEvent:Connect(function()
    players.PlayerGui:WaitForChild("ScreenGui").Spawn.TextButton.Text = "Disabled"
    players.PlayerGui.ScreenGui.Spawn.TextButton.LocalScript.Disabled = true
    players.PlayerGui.ScreenGui.Spawn.TextButton.BackgroundColor3 = Color3.new(170,0,0)
end)
0
Why are you modifying the StarterGui childrens from server if you are doing it using an event, also does your script have any errors ? Axdrei 107 — 5y
0
modifying the startergui so that when a new player joins the game the gui should be disabled for then aswell. It does not have any errors WillBe_Stoped 71 — 5y

Answer this question