Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Chat Bubble Script help? **REPOSTED AND UNSOLVED**

Asked by
Mauvn 100
10 years ago

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)

0
Is there an out put, also explain more what your having difficulty with. HexC3D 830 — 10y
0
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. lomo0987 250 — 10y
0
Ok thanks for the tip i'll go try it out. Mauvn 100 — 10y

1 answer

Log in to vote
-1
Answered by
mhd100 5
10 years ago

Try this script but edit the group numbers;

local spawnbin = {}

function findSpawns(root) local childers = root:getChildren() for i = 1,#childers do if childers[i].className == "SpawnLocation" then table.insert(spawnbin,childers[i]) elseif childers[i].className == "Model" then findSpawns(childers[i]) end end end

findSpawns(game.Workspace)

function findTags(player) local tags = "" if player:IsInGroup(217181) then rank = player:GetRoleInGroup(217181) tags = rank end return tags end

function onPlayerRespawned(newPlayer) local mycurrentspawns = {} for i = 1,#spawnbin do if spawnbin[i].TeamColor == newPlayer.TeamColor then table.insert(mycurrentspawns,spawnbin[i]) end end if #mycurrentspawns < 1 then return end movetospawn(newPlayer,mycurrentspawns[math.random(1,#mycurrentspawns)]) end

function movetospawn(player,spawn) if player ~= nil and spawn ~= nil then local torso = player.Character:findFirstChild("Torso") if torso ~= nil then torso.CFrame = spawn.CFrame + Vector3.new(0,2,0) end end end

function onPlayerEntered(newPlayer) wait(1) player = newPlayer onPlayerRespawned(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end

game.Players.PlayerAdded:connect(onPlayerEntered)

p = game.Players:GetPlayers() for i = 1,#p do onPlayerEntered(p[i]) end

while true do players = game.Players:GetPlayers() for i = 1,#players do player = players[i] char = player.Character if char ~= nil then if char:findFirstChild("Head") ~= nil then local test = char.Head:findFirstChild("RankGui") if test == nil then local bg = script.RankGui:clone() local label = bg.Label local rank = "" if game:GetService("Teams") ~= nil then local teams = game.Teams:getChildren() local vTeam = nil for t = 1,#teams do if teams[t].TeamColor == player.TeamColor then vTeam = teams[t] end end if vTeam == nil then rank = "Guest" else rank = vTeam.Name end else rank = "Guest" end if findTags(player) ~= "" then rank = findTags(player) end label.TextStrokeColor3 = player.TeamColor.Color label.Text = rank bg.Parent = player.Character:findFirstChild("Head") end end end end wait(0.1) end

0
Could you please do Code block? Mauvn 100 — 10y
Ad

Answer this question