Hi! I'm having troubles to where if someone clicks the menu button when they die, they respawn and that's where the menu doesn't take effect anymore unless they click again.
local Player = game.Players.LocalPlayer.Character
local PlayerGUI = game.Players.LocalPlayer:WaitForChild('PlayerGui')
local SG = game:GetService("StarterGui")
local CanClick = true
function onButtonClicked()
CanClick = false
game.Players.CharacterAutoLoads = false
Player.Humanoid.Health = 0
script.Parent.Parent.Parent.MenuButton.Visible = false
script.Parent.Parent.Parent.Menu.Visible = true
PlayerGUI.HealthGui.Enabled = false
PlayerGUI.CurrentVersion.Enabled = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
SG:SetCoreGuiEnabled("Backpack", false)
Player.Humanoid.Died:Connect(function()
Player:Remove()
end)
wait(10)
CanClick = true
end
script.Parent.MouseButton1Click:connect(onButtonClicked)

2 comments
kick them
kick them