I'm making my own chat GUI but I wanted the name to be a different color to the message so I used a way I think would work. I've tried lots of things to fix it but when I chat nothing appears in the GUI, this is my script (It doesn't return an error so it must be something I've done):
CustomNames = {{"Player",Vector3.new(255/255,255/255,255/255)}}
game.Players.PlayerAdded:connect(function(plr)
color = Vector3.new(math.random(0,255)/math.random(0,255),math.random(0,255)/math.random(0,255),math.random(0,255)/math.random(0,255))
for i,v in pairs(CustomNames) do
if plr.Name == v[1] then
color = v[2]
return
end
end
plr.Chatted:connect(function(msg)
for i,v in pairs(game.Players:GetChildren()) do
gui = v:FindFirstChild("PlayerGui"):FindFirstChild("ChatGUI")
for i,x in pairs(gui.Box:GetChildren()) do
if x:IsA("TextLabel") then
x:TweenPosition(UDim2.new(x.Position-UDim2.new(0,0,0,-20)),"Out","Sine",0.5,true)
if x.AbsolutePosition.Y <= 0 then
x:remove()
end
end
end
name = game.ReplicatedStorage.Text:Clone()
name.Parent = gui.Box
name.Position = UDim2.new(0,0,0,180)
name.Size = UDim2.new(0,string.len(plr.Name)*10+10,0,20)
name.Text = plr.Name..":"
name.TextColor3 = color
name.TextStrokeColor3 = color
name.TextStrokeTransparency = 0.5
chat = game.ReplicatedStorage.Text:Clone()
chat.Parent = gui.Box
chat.Position = UDim2.new(0,string.len(plr.Name)*10+10,0,180)
chat.Size = UDim2.new(0,600-(string.len(plr.Name)*10+10),0,20)
chat.Text = msg
chat.TextColor3 = Vector3.new(255/255,255/255,255/255)
chat.TextStrokeColor3 = Vector3.new(0/255,0/255,0/255)
chat.TextStrokeTransparency = 0.8
end
end)
end)
