It works in studio, but outside studio it does not work. The error is on line 20
I get this error in Server Log:
Infinite yield possible on 'Players.Nanaluk01.PlayerGuiWaitforChild("ChatGui")' Script 'ServerScriptService.Chat', Line 20
How can I fix this?
Here Is The Coding:
Please Note: -The Error Lies On Line 20 -The .Fr you can see is Frame. I don't know why it disappears in this question.
function UpdateOldLabels(Parent)
for i,v in pairs(Parent:GetChildren()) do
if v.Name:sub(1,4):lower() == "line" then
local LineNumber = v.Name:sub(5)
if LineNumber == "7" then
v:Destroy()
else
v.Name = "line"..tostring(tonumber(LineNumber) + 1)
v.Position = v.Position - UDim2.new(0,0,0,15)
end
end
end
end
game.Players.PlayerAdded:connect(function(player)
for _,v in ipairs(game:GetService("Players"):GetChildren()) do
wait(1)
UpdateOldLabels(v:WaitForChild("PlayerGui"):WaitForChild("ChatGui").Frame)
if player then
newchatline = Instance.new("TextLabel",v:WaitForChild("PlayerGui").ChatGui.Frame)
newchatline.Text = "[Server] "..player.Name.. " Has Joined The Server!"
newchatline.Size = UDim2.new(1,0,0,20)
newchatline.Position = UDim2.new(0,0,1,-15)
newchatline.Font = "ArialBold"
newchatline.TextStrokeTransparency = 1
newchatline.BackgroundTransparency = 1
newchatline.BorderSizePixel = 0
newchatline.FontSize = "Size18"
newchatline.TextXAlignment = "Left"
newchatline.TextYAlignment = "Top"
newchatline.ClipsDescendants = true
newchatline.Name = "line1"
newchatline.TextColor3 = Color3.new(1,1,1)
end
end
UpdateOldLabels(game:GetService("StarterGui").ChatGui.Frame)
newchatline:Clone().Parent = game:GetService("StarterGui").ChatGui.Frame
player.Chatted:connect(function(msg)
for _,v in ipairs(game:GetService("Players"):GetChildren()) do
UpdateOldLabels(v:WaitForChild("PlayerGui").ChatGui.Frame)
newchatline = Instance.new("TextLabel",v:WaitForChild("PlayerGui").ChatGui.Frame)
newchatline.Text = player.Name..": "..msg
newchatline.Size = UDim2.new(1,0,0,20)
newchatline.Position = UDim2.new(0,0,1,-15)
newchatline.Font = "ArialBold"
newchatline.TextStrokeTransparency = 1
newchatline.BackgroundTransparency = 1
newchatline.BorderSizePixel = 0
newchatline.FontSize = "Size18"
newchatline.TextXAlignment = "Left"
newchatline.TextYAlignment = "Top"
newchatline.ClipsDescendants = true
newchatline.Name = "line1"
newchatline.TextColor3 = Color3.new(1,1,1)
end
UpdateOldLabels(game:GetService("StarterGui").ChatGui.Frame)
newchatline:Clone().Parent = game:GetService("StarterGui").ChatGui.Frame
end)
end)

1 comment
HI i do a cobatsystem but when i fixed some thnig my program crashed and when i got back is give this error ?