So I want to make a map loader GUI, and when a ImageButton is pressed, it will check if there's already a map in a folder and if there is, delete it.
Here's my code:
script.Parent.MouseButton1Click:Connect(function(click) if game.Teams:FindFirstChildOfClass("Model") == true then -- This is the part that doesnt work game.Teams:ClearAllChildren() else game.ServerStorage.SMG:Clone() game.ServerStorage.SMG.Parent = game.Teams.Red game.ServerStorage.SMG:Clone() game.ServerStorage.SMG.Parent = game.Teams.Red end end)
try this:
script.Parent.MouseButton1Click:Connect(function(click) if game.Teams:FindFirstChildOfClass("Model") then -- This might work game.Teams:ClearAllChildren() else game.ServerStorage.SMG:Clone() game.ServerStorage.SMG.Parent = game.Teams.Red game.ServerStorage.SMG:Clone() game.ServerStorage.SMG.Parent = game.Teams.Red end end)