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

Script to choose "team"?

Asked by
Paldi 109
9 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

I have a problem with this script, when i click the button(gui) if the id[d].Value ~= "none", it will make another gui visible but i need it to do this only if ALL the id[d].value ~= "none". Hope you understand

id are StringValue ui is a screengui

local id = game.Workspace.Guards:GetChildren()
local player = script.Parent.Parent.Parent.Parent.Parent
local ui = script.Parent.Parent.Parent.Parent.UI
local foundplayer = false

function OnClicked()
    for d = 1,  #id do
        if foundplayer == false then
        if id[d].Value == "None" then
            foundplayer = true
            ui.Id.Value = id[d].Name
            id[d].Value = player.Name
    local spawn = game.Workspace.GuSpawns:FindFirstChild("Spawn"..d)
            ui.Team.Value = "Guards"
                    player.Character.Torso.CFrame = CFrame.new(Vector3.new(spawn.Position.x, spawn.Position.y + 3, spawn.Position.z))

            local ui2 = ui:GetChildren()
            for o = 1,#ui2 do
                if ui2[o].ClassName == "Frame" then
                ui2[o].Visible = true
                end
            end 
               ui.Clock.Visible = true
               ui.Character.Visible = false
               ui.Crafting.Visible = false
               ui.Sections.Character.Visible = false
               ui.Sections.Crafting.Visible = false
            script.Parent.Parent.Visible = false
    end
        if id[d].Value ~= "None" then
            script.Parent.Parent.Full.Gu.Visible = true
            wait(2)
            script.Parent.Parent.Full.Gu.Visible = false
end
    end
end
foundplayer = false
end

script.Parent.MouseButton1Click:connect(OnClicked)
1
This has Nothing related to "teams" woodengop 1134 — 9y
0
its not related to normal roblox teams, sorry i forgot to mention it! Paldi 109 — 9y

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

If you want it to check if all the values are "none", I recommend using a generic loop. Ex:

local id = game.Workspace.Guards:GetChildren()
AllNone = true

for i,v in pairs(id) do
    if v.Value ~= "none" then
        AllNone = false
    end
end)
-- Put an if statement, if AllNone is equal to false, and perform your function
Ad

Answer this question