I have 2 problems, I don’t want to post separately to avoid spam if that’s fine.
Script 1:
Players will not get inserted into a table. The while loop works, but when I try it the table has nothing and “Game started” does not print. I have a remotevent and script that gives the “Flood Escape” tag that 100% works. Server sided, script
Script
local textchange = game.ReplicatedStorage.TextChangers:WaitForChild("Flood Escape")
local plrsplaying = {}
while true do
while #plrsplaying == 0 do
wait(1)
print("loop")
textchange.Value = "Waiting..."
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("Flood Escape") then
table.insert(plrsplaying, 1, v.Name)
end
end
end
print("Game started")
wait(1)
end
Script 2:
The text does not change when the value is changed by Script 1, but it does when I manually change it in ReplicatedStorage. The script has the variable “textchange” which when changed, will also change the text of the TextLabel. Client Sided, LocalScript
Script
local txt = script.Parent.TxtCP
local gamefolder = game.ReplicatedStorage.TextChangers
local gamepick = gamefolder:FindFirstChild("None")
txt:GetPropertyChangedSignal("Value"):Connect(function()
local gamepick = gamefolder:FindFirstChild(txt.Value)
if not gamepick then return end
gamepick:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = gamepick.Value
end)
end)
To your first problem, your script is not printing “Game started” because it is not exiting the loop because nothing is ever added into the table. You are looking for a child called “Flood Escape” under the player. You said it is a tag. If this is a tag then you are using CollectionService? In this case, your if statement should be more like this:
if (CollectionService:HasTag(v, "Flood Escape") then -- Assuming your tag is called "Flood Escape"
table.insert(plrsplaying, v.Name)
end
@bossay6
How are you adding a tag? Do you mean like a BoolValue that you are adding to the player? If this is the case I would try to add your “tag” to the character instead of the player. Then you can use the FindFirstChild method but you would have to search for the child under the character.
i am a huge dummy… i set the tag value to “Flood Escape” and not the name and did not detect a stringvalue with the name “Flood Escape”… still looking for an answer for script 2
I am having trouble understanding your second problem. There is supposed to be another script changing the text of your text label, correct? What is the code for that script?
Quick explanation: I have a button that changes the value of txt, when value of txt is changed, it will change the value of gamepick to the instance that will change the text, and when gamepick value has changed, it will set the text. I have done it this way to automate things
And the problem is that your text never changes, correct? So in other words, this line of code doesn’t happen:
script.Parent.Text = gamepick.Value
Have you tried putting any print statements in your code to see if those functions run?
Also, I don’t think this is your problem but it is easier to just use .Changed for a Value instance. Like this:
i just had another im a dummy moment, since the text stayed the same, the script didnt detect and change in the value so the value stayed as default, which is blank.