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

I have an error in this script (Expect end to close function) plz help?? {ANSWERED!}

Asked by
Ewiq44 2
4 years ago
Edited 4 years ago

I am trying to make titles so people can know who u are in game (e.g: Owner, Tester,Developer) and when i play test it gives an error. It says "Expected end to close function in line 3" here is the script (hope you can help :D)

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

game.Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function(character)

    end)

    if player.Name == "Ewiq44" then
        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Owner"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(254,162,82)
        clonedgui.Parent = game.Workspace:WaitForChild(player.name).Head

        end

if player.Name == "not gonna show the username on this post" then
        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Tester"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(163,0,153)
        clonedgui.Parent = game.Workspace:WaitForChild(player.name).Head

end

0
The script is not showing properly, sorry. Line 1 & 2 are missing! Ewiq44 2 — 4y
0
The first 2 lines are local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui") and game.Players.PlayerAdded:Connect(function(player) Ewiq44 2 — 4y

2 answers

Log in to vote
0
Answered by
Alphexus 498 Moderation Voter
4 years ago
Edited 4 years ago

That error means that you forgot an “end)” for your function. The simple solution is to put another “end)” one line before your last “end”. Also make sure your ends have a “)” since it’s an event.

Ad
Log in to vote
0
Answered by
NSMascot 113
4 years ago
Edited 4 years ago
player.CharacterAdded:Connect(function(character)

    end)

    if player.Name == "Ewiq44" then
        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Owner"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(254,162,82)
        clonedgui.Parent = game.Workspace:WaitForChild(player.name).Head

        end

if player.Name == "not gonna show the username on this post" then
        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Tester"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(163,0,153)
        clonedgui.Parent = game.Workspace:WaitForChild(player.name).Head
end
end

or

player.CharacterAdded:Connect(function(character)

    end)

    if player.Name == "Ewiq44" then
        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Owner"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(254,162,82)
        clonedgui.Parent = game.Workspace:WaitForChild(player.name).Head

        end

if player.Name == "not gonna show the username on this post" then
        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Tester"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(163,0,153)
        clonedgui.Parent = game.Workspace:WaitForChild(player.name).Head
end

i dont know how many ends you need, but one of these should work! i hope this works...

Answer this question