What is wrong With This chat Bubble script?
I have a Chat Bubble Script that if a Player Talk The chat bubble over his head will show his Group rank, But it's not working. Please Help!
002 | local c = char:GetChildren() |
004 | if c [ i ] .className = = "Model" then |
011 | function onChatted(msg, recipient, speaker) |
012 | if speaker.Character ~ = nil then |
013 | clear(speaker.Character) |
014 | if msg = = "RANK" then |
015 | local person = game.Workspace.MainScript.Members:findFirstChild(speaker.Name) |
016 | if person ~ = nil then |
017 | local bubble = script.BubbleSpeech:clone() |
018 | bubble.PrevL.Value = 30 |
019 | bubble.Name = person.Name.. " is rank " .. tostring (person.Value) |
020 | bubble.Head.BrickColor = BrickColor.new( "Toothpaste" ) |
021 | bubble.Parent = speaker.Character |
023 | local bubble = script.BubbleSpeech:clone() |
024 | bubble.PrevL.Value = 30 |
025 | bubble.Name = speaker.Name.. " is not a member of SS" |
026 | bubble.Head.BrickColor = BrickColor.new( "Toothpaste" ) |
027 | bubble.Parent = speaker.Character |
031 | if string.len(msg) < 101 then |
032 | local bubble = script.BubbleSpeech:clone() |
034 | bubble.PrevL.Value = string.len(bubble.Name) |
035 | bubble.Parent = speaker.Character |
036 | bubble.Head.Anchored = false |
037 | bubble.Head.CanCollide = false |
039 | if string.len(msg) > 100 and string.len(msg) < 201 then |
041 | local bubble = script.BubbleSpeech:clone() |
042 | bubble.Name = string.sub(msg, 1 , 100 ) |
043 | bubble.PrevL.Value = 100 |
044 | bubble.Parent = speaker.Character |
045 | bubble.Head.Anchored = false |
046 | bubble.Head.CanCollide = false |
049 | local bubble 2 = script.BubbleSpeech:clone() |
050 | bubble 2. Name = string.sub(msg, 100 , 200 ) |
051 | bubble 2. PrevL.Value = 100 + string.len(bubble 2. Name) |
052 | bubble 2. Parent = speaker.Character |
053 | bubble 2. Head.Anchored = false |
054 | bubble 2. Head.CanCollide = false |
061 | if string.len(msg) > 200 and string.len(msg) < 301 then |
063 | local bubble = script.BubbleSpeech:clone() |
064 | bubble.Name = string.sub(msg, 1 , 100 ) |
065 | bubble.PrevL.Value = 100 |
066 | bubble.Parent = speaker.Character |
067 | bubble.Head.Anchored = false |
068 | bubble.Head.CanCollide = false |
075 | local bubble 2 = script.BubbleSpeech:clone() |
076 | bubble 2. Name = string.sub(msg, 100 , 200 ) |
077 | bubble 2. PrevL.Value = 200 |
078 | bubble 2. Parent = speaker.Character |
079 | bubble 2. Head.Anchored = false |
080 | bubble 2. Head.CanCollide = false |
085 | local bubble 3 = script.BubbleSpeech:clone() |
086 | bubble 3. Name = string.sub(msg, 200 , 300 ) |
087 | bubble 3. PrevL.Value = 200 + string.len(bubble 3. Name) |
088 | bubble 3. Parent = speaker.Character |
089 | bubble 3. Head.Anchored = false |
090 | bubble 3. Head.CanCollide = false |
101 | function onPlayerEntered(newPlayer) |
103 | newPlayer.Chatted:connect( function (msg, recipient) onChatted(msg, recipient, newPlayer) end ) |
106 | game.Players.ChildAdded:connect(onPlayerEntered) |