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

01local id = game.Workspace.Guards:GetChildren()
02local player = script.Parent.Parent.Parent.Parent.Parent
03local ui = script.Parent.Parent.Parent.Parent.UI
04local foundplayer = false
05 
06function OnClicked()
07    for d = 1,  #id do
08        if foundplayer == false then
09        if id[d].Value == "None" then
10            foundplayer = true
11            ui.Id.Value = id[d].Name
12            id[d].Value = player.Name
13    local spawn = game.Workspace.GuSpawns:FindFirstChild("Spawn"..d)
14            ui.Team.Value = "Guards"
15                    player.Character.Torso.CFrame = CFrame.new(Vector3.new(spawn.Position.x, spawn.Position.y + 3, spawn.Position.z))
View all 40 lines...
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:

1local id = game.Workspace.Guards:GetChildren()
2AllNone = true
3 
4for i,v in pairs(id) do
5    if v.Value ~= "none" then
6        AllNone = false
7    end
8end)
9-- Put an if statement, if AllNone is equal to false, and perform your function
Ad

Answer this question