Put it in a local script in the players starter gui and another local script in the part. I'm not sure the starter gui folder will target a specific player's gui. Also a player's gui folder can't be edited or viewed from outside the folder unless made from outside the folder.
Local Script in the StarterGui
local text = tonumber(script.Parent.PlayerCount.Frame.TextLabel.Text)
local bool = Instance.new('BoolValue', script.Parent.Parent)
bool.Name = 'GuiBool'
while text <= 1 do
wait()
if text > 1 then
bool.Value = True
end
end
Local Script inside the part
game.Players.PlayerAdded:Connect(function(plr)
script.Parent.Touched:Connect(function(hit)
if hit.Parent == plr.Name then
if plr.GuiBool.Value == True then
script.Parent.CanCollide = False
end
end
end)
end)
Haven't tested it yet so hope it works
3 comments
TextLabels don't have a Value property.
You can do "if tonumber(TextLabel.Text) > 1 then".
What should I do to the script then? Can you put it as an answer so I understand where I am wrong? As if the code below won't function, I can't see how yours does. @MCAndRobloxUnited