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

Map loader GUI's button won't delete a map when told to?

Asked by
Mexual 2
4 years ago

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)

1 answer

Log in to vote
0
Answered by
gloveshun 119
4 years ago

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)
Ad

Answer this question