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

Creating 2 Guis, That position is based on the first ones character length.?

Asked by 10 years ago

I have created a chat gui, which is efficient besides the fact that unlike robloxs default. The textlabel itself is 1 so the color is 1. I want to make it so the name is the players team color and the text is right beside it is white. Im using remotefunction to translate it from local to serverside. But here is local

Local

function onkey2(enter)
    msg = textbox.Text
    if enter == true and script.Parent.Text:sub(1,1) ~= "/"
        then
        print(msg)
        game.Workspace.Exodus.RemoteFunction:InvokeServer(msg)
        sc.Chat.Sentence.Value = msg
        script.Parent.Text = script.Value.Value
    end
    --Kicking Script--
    if msg:sub(1,5) == "/kick" and enter == true
        then
        print("Kick Command")
        script.Parent.Text = script.Value.Value
        if rank >=2
            then
        check = msg:sub(7, msg:len()):lower()
        print(check)
        num = msg:len()-6
        for i, v in pairs(game.Players:GetChildren()) do
            if v.Name:len() >= num
                then
                name = v.Name:sub(1,num):lower()
                print(check)
            if name == check and v ~= player
                then
                print("Found")
                localmsg("Succesfully Kicked: "..v.Name)
                v:remove()
            end
        end
        end
        end 
    end
    --End of Kicking Script--
    --Teleport Script--
end

and here is server

function script.RemoteFunction.OnServerInvoke(player, msg)
    print(player,msg)
            for i,v in pairs(script.Chat.Chat:GetChildren()) do
        if v.ClassName == "TextLabel"
            then
            pos = v.Position
        newpos = pos-UDim2.new(0, 0, .1666, 0)
        v.Position = newpos
        end
    end
    for i, v in pairs(game.Players:GetChildren()) do
        if v.PlayerGui:FindFirstChild("Chat") ~= nil
            then
            chat = v.PlayerGui:FindFirstChild("Chat")
            for i, v in pairs(chat.Chat:GetChildren()) do
                if v.ClassName == "TextLabel"
            then
            pos = v.Position
        newpos = pos-UDim2.new(0, 0, .1666, 0)
        v.Position = newpos
        end
            end
        end
    end
    chat = game.Lighting.Chat:clone()
    chat.Text = player.Name..": "..msg
    chat.Parent = script.Chat.Chat
    for i, v in pairs(game.Players:GetChildren()) do
        if v:FindFirstChild("PlayerGui") ~= nil
            then
            if v:FindFirstChild("PlayerGui"):FindFirstChild("Chat")
                then
                bin = v:FindFirstChild("PlayerGui"):FindFirstChild("Chat").Chat
    chat = game.Lighting.Chat:clone()
    chat.Text = player.Name..": "..msg
    chat.Parent = bin
    end
        end
    end
end

Above, Actually just noticed the scripts above dont have anything to do with the guis UDim2

Answer this question