Hello, i'm doing a custom chat bubble script and when a player talks it will show his group rank, but it doesn't show it. Any kind of help is appreciated! :)
Script:
function clear(char)
local c = char:GetChildren()
for i = 1,#c do
if c[i].className == "Model" then
c[i]:Remove()
end
end
end
function onChatted(msg, recipient, speaker)
if speaker.Character ~= nil then
clear(speaker.Character)
if msg == "RANK" then
local person = game.Workspace.MainScript.Members:findFirstChild(speaker.Name)
if person ~= nil then
local bubble = script.BubbleSpeech:clone()
bubble.PrevL.Value = 30
bubble.Name = person.Name.." is rank "..tostring(person.Value)
bubble.Head.BrickColor = BrickColor.new("Toothpaste")
bubble.Parent = speaker.Character
else
local bubble = script.BubbleSpeech:clone()
bubble.PrevL.Value = 30
bubble.Name = speaker.Name.." is not a member of SS"
bubble.Head.BrickColor = BrickColor.new("Toothpaste")
bubble.Parent = speaker.Character
end
else
if string.len(msg) < 101 then
local bubble = script.BubbleSpeech:clone()
bubble.Name = msg
bubble.PrevL.Value = string.len(bubble.Name)
bubble.Parent = speaker.Character
bubble.Head.Anchored = false
bubble.Head.CanCollide = false
end
if string.len(msg) > 100 and string.len(msg) < 201 then
local bubble = script.BubbleSpeech:clone()
bubble.Name = string.sub(msg,1,100)
bubble.PrevL.Value = 100
bubble.Parent = speaker.Character
bubble.Head.Anchored = false
bubble.Head.CanCollide = false
--bubble.Row.Value = 1.5
local bubble2 = script.BubbleSpeech:clone()
bubble2.Name = string.sub(msg,100,200)
bubble2.PrevL.Value = 100 + string.len(bubble2.Name)
bubble2.Parent = speaker.Character
bubble2.Head.Anchored = false
bubble2.Head.CanCollide = false
end
if string.len(msg) > 200 and string.len(msg) < 301 then
local bubble = script.BubbleSpeech:clone()
bubble.Name = string.sub(msg,1,100)
bubble.PrevL.Value = 100
bubble.Parent = speaker.Character
bubble.Head.Anchored = false
bubble.Head.CanCollide = false
--bubble.Row.Value = 3
wait(0.5)
local bubble2 = script.BubbleSpeech:clone()
bubble2.Name = string.sub(msg,100,200)
bubble2.PrevL.Value = 200
bubble2.Parent = speaker.Character
bubble2.Head.Anchored = false
bubble2.Head.CanCollide = false
--bubble2.Row.Value = 1.5
wait(0.5)
local bubble3 = script.BubbleSpeech:clone()
bubble3.Name = string.sub(msg,200,300)
bubble3.PrevL.Value = 200 + string.len(bubble3.Name)
bubble3.Parent = speaker.Character
bubble3.Head.Anchored = false
bubble3.Head.CanCollide = false
end
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)

3 comments
Is there an out put, also explain more what your having difficulty with.
What Hex said and also if there is no errors/output, put in prints in each stage of the script, it will tell you what it gets to.
Ok thanks for the tip i'll go try it out.