Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

2 comments

0

The script is not showing properly, sorry. Line 1 & 2 are missing!

0

The first 2 lines are local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui") and game.Players.PlayerAdded:Connect(function(player)

2 answers

✓ Accepted answer

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.

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...

This discussion is preserved as it was. New answers, comments, and votes are closed.