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

Expected <eof>, got 'end'?

Help please. Writes an error Expected , got 'end' here is the script

local plr = game.Players.LocalPlayer
local vipServerOwnerId = game.ReplicatedStorage.Interactions.Server.GetVIPServerOwnerID:InvokeServer()

local specialColors = {}
specialColors["635035673"] = Color3.fromRGB(255, 221, 0) -- BlockyShadows

function givePlayerNameTag(thisPlr)
	
	-- Make sure player
	local chr = thisPlr.Character
	if chr ~= nil and thisPlr ~= plr then
		
		-- Create nametag
		local tag = script.NameTag:clone()
		
		-- Set information
		tag.Label.Text = thisPlr.Name
		if thisPlr.UserId == vipServerOwnerId then
			tag.Label.Text = "[SERVER OWNER] " .. thisPlr.Name
			tag.Label.TextColor3 = Color3.fromRGB(255, 0, 255)
		elseif thisPlr.UserId == "erer" then
			tag.Label.Text = "[CREATOR] " .. thisPlr.Name
			tag.Label.TextColor3 = Color3.fromRGB(255, 0, 0)
		end
		elseif thisPlr.UserId == "OsipStar4ik" then
			tag.Label.Text = "[DEVELOPER] " .. thisPlr.Name
			tag.Label.TextColor3 = Color3.fromRGB(255, 0, 0)
		end
		for id, c in pairs(specialColors) do
			if tostring(thisPlr.UserId) == id then
				tagLabel.TextColor3 = c
			end
		end
		
		-- Add to head
		tag.Parent = chr:WaitForChild("Head")
		
	end
	
"" 

game.Players.PlayerAdded:connect(function(thisPlr)
	
	-- Assign event
	thisPlr.CharacterAdded:connect(function()
		givePlayerNameTag(thisPlr)
	end)
	givePlayerNameTag(thisPlr)
	
end)

for _, i in pairs(game.Players:GetPlayers()) do
	i.CharacterAdded:connect(function()
		givePlayerNameTag(i)
	end)
	givePlayerNameTag(i)
end

1 answer

✓ Accepted answer

Seems like the only problem here was that you added a random quote string at line 40, so I simply removed that.

local plr = game.Players.LocalPlayer
local vipServerOwnerId = game.ReplicatedStorage.Interactions.Server.GetVIPServerOwnerID:InvokeServer()

local specialColors = {}
specialColors["635035673"] = Color3.fromRGB(255, 221, 0) -- BlockyShadows

function givePlayerNameTag(thisPlr)

    -- Make sure player
    local chr = thisPlr.Character
    if chr ~= nil and thisPlr ~= plr then

        -- Create nametag
        local tag = script.NameTag:clone()

        -- Set information
        tag.Label.Text = thisPlr.Name
        if thisPlr.UserId == vipServerOwnerId then
            tag.Label.Text = "[SERVER OWNER] " .. thisPlr.Name
            tag.Label.TextColor3 = Color3.fromRGB(255, 0, 255)
        elseif thisPlr.UserId == "erer" then
            tag.Label.Text = "[CREATOR] " .. thisPlr.Name
            tag.Label.TextColor3 = Color3.fromRGB(255, 0, 0)
        end
        elseif thisPlr.UserId == "OsipStar4ik" then
            tag.Label.Text = "[DEVELOPER] " .. thisPlr.Name
            tag.Label.TextColor3 = Color3.fromRGB(255, 0, 0)
        end
        for id, c in pairs(specialColors) do
            if tostring(thisPlr.UserId) == id then
                tagLabel.TextColor3 = c
            end
        end

        -- Add to head
        tag.Parent = chr:WaitForChild("Head")

    end


game.Players.PlayerAdded:connect(function(thisPlr)

    -- Assign event
    thisPlr.CharacterAdded:connect(function()
        givePlayerNameTag(thisPlr)
    end)
    givePlayerNameTag(thisPlr)

end)

for _, i in pairs(game.Players:GetPlayers()) do
    i.CharacterAdded:connect(function()
        givePlayerNameTag(i)
    end)
    givePlayerNameTag(i)
end

4 comments

0

I have another problem

0

Players.OsipStar4ik.PlayerScripts.NameTagGiver:36: attempt to index nil with 'Parent'

0

I think you might have misused the "end" at line 24, so try removing it and adding another "end" to line 37

0

specifically add it after the "tag.Parent = chr:WaitForChild("Head")" part

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