I’m trying to make a main menu which props up every time you die, or join the game.
Apart of that Main Menu is a Job select, which works but I can’t get it to resetonspawn so next time the player dies it pops up.
click on the gui that holds this and send a picture of the properties tab!
Click the box beside ResetOnSpawn to turn it on.
I want to turn it on using code.
Oh, can you send the code that you made for it?
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local items = script.Parent:GetChildren()
for i,v in pairs(items) do
if v:IsA("TextButton") then
table.insert(newTable,v)
end
end
for i,v in pairs(newTable) do
v.MouseButton1Click:Connect(function()
script.Parent.splat:Play()
local plr = script.Parent.Parent.Parent.Parent
print(plr.Name)
local team = game.Teams:FindFirstChild(v.Text)
plr.TeamColor = team.TeamColor
script.Parent.Parent.Enabled = false
plr.PlayerGui.MainMenu.ResetOnSpawn = true
wait(.1)
plr:LoadCharacter()
end)
end```
You seem to be looping through a table but also waiting for the button to be clicked. they need to be different functions otherwise that would never work!
I’m trying to understand why you can’t just leave it on all the time? What does it do that you don’t want it to do when you just turn it on, and leave it on through the properties window?
It was meant to be a main menu from Neighborhood of Robloxia V.4, I found my own weird way of solving it.
I have like 30 buttons so I need to loop through all of them.
You are enabling the ResetOnSpawn of the gui which is already replicated to player (plr.PlayerGui.MainMenu). When the player dies that gui is destroyed. Instead, try:
game:GetService("StarterGui").MainMenu.ResetOnSpawn = true