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

Im Trying To Make a SurfaceGui That displays a chat when a command is Prompt Can Someone help?

Asked by 10 years ago

Im trying to make this work and when i run it, it says " Label4 is not a valid member of SurfaceGui" or something along those lines this is what I have so far... Can Someone Help fix it please?

local l1 = script.Parent.Labell1
local l2 = script.Parent.Label2
local l3 = script.Parent.Label3
local l4 = script.Parent.Label4

function addMessage(player, text)
    l4.Text = l3.Text
    l3.Text = l2.Text
    l2.Text = l1.Text
    l1.Text = "- " .. player .. ": " .. text
end

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(chat)
        if string.sub(chat, 1, 4) == "msg/" then
            addMessage(player.Name, string.sub(chat, 5))

        end
    end)
end)

Answer this question