-
What do you want to achieve?
I want to turn off a GUI after a player clicks a button -
What is the issue? Include screenshots / videos if possible!
I am trying to turn off a GUI via a function, it does this but I also scripted it that if you press the button that a player respawns. And after the player respawns it basically appears again. I will share my local- and server sided script with you all. I would appreciate help, criticism and tips! Thanks in advance.
Local script:
local button = script.Parent
local teams = game.Teams
local player = game.Players.LocalPlayer
local RemoteEvent = game.ReplicatedStorage:WaitForChild("TeamChanger2")
button.MouseButton1Click:Connect(function()
RemoteEvent:FireServer()
script.Parent.Parent.Parent.Enabled = false
end)
Serverscript
local teams = game:GetService("Teams")
local remoteEvent = game:GetService("ReplicatedStorage").TeamChanger2
local player = nil
local Team = game:GetService("Teams").Citizen
remoteEvent.OnServerEvent:Connect(function(plr)
player = plr
player.Team = game.Teams:FindFirstChild("Citizen")
player:LoadCharacter()
end)