Getting Syntax error near 'End' - Roblox Luau

Hi i am getting that syntax error but i can’t fix it.
Can you guys help me with this?

I ran it through an compiler and they all say its in line 11? i checked it 100 times but i cannot find anything. This code is btw for a roblox game.

Code:

local CollectionService = game:GetService('CollectionService')
local ReplicatedStorage = game:GetService('ReplicatedStorage')

local Items = ReplicatedStorage:WaitForChild('Items')
local Tycoons = game.Workspace:WaitForChild('Tycoons')

local PlaceholderTycoon = ReplicatedStorage:WaitForChild('Tycoon')

-- clear all items tycoons
for _, Tycoon in CollectionService:GetTagged('Tycoon') do
	if Tycoon:IsDescendantOf(ReplicatedStorage) then continue end
			Tycoon.Items:ClearAllChildren()
end

local function GetItemInTycoonById(itemId)
	for _, Item in PlaceholderTycoon.Items:GetChildren() do
		if Item:GetAttribute('Id') == itemId then
			return Item
		end
	end
end

local function getItem(itemId)
	for _, Item in Items:GetChildren() do
		if Item:GetAttribute('Id') == itemId then
			return Item
		end
	end
end

local function assignTycoon(player)
	for _, Tycoon in Tycoons:GetChildren() do
		if Tycoon:GetAttribute("Taken") then continue end
		Tycoon:SetAttribute("Taken", true)
		Tycoon:SetAttribute("UserId", player.UserId)
		return Tycoon
	end
end

local function getRelativeCFrame(itemId)
	local Item = GetItemInTycoonById(itemId)
	
	local relativeCF = PlaceholderTycoon.PrimaryPart.CFrame:ToObjectSpace(Item:GetPivot())
	return relativeCF
end

local function getTycoon(player)
	for _, tycoon in game.Workspace.Tycoons:GetChildren() do
		if tycoon:GetAttribute('UserId') == player.UserId then
			return tycoon
		end
	end
end

local function unlockedItem(player, itemId)
	local tycoon = getTycoon(player)
	if not tycoon then return end
	
	local Item = getItem(itemId):Clone()
	local Cost = Item:GetAttribute('Cost')
	
	if player.leaderstats.Cash.Value < Cost then
		return false
	end
	
	player.leaderstats.Cash.Value -= Cost
	
	local RelativeCF = getRelativeCFrame(itemId)
	
	local WorldCF = tycoon.PrimaryPart.CFrame:toWorldSpace(RelativeCF)
	
	Item:PivotTo(WorldCF)
	Item.Parent = tycoon.Items
	
	return true
	
	
end

for _, Button in CollectionService:GetTagged('Button') do
	Button.Touched:Connect(function(hit)
		
		if Button:GetAttribute('Unlocked') then return end
		
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if not player then return end
		
		local tycoon = getTycoon(player)
		if not tycoon then return end
		
		if not Button:IsDescendantOf(tycoon) then return end
		
		local succes = unlockedItem(player, Button:GetAttribute('ItemId'))
		if not succes then return end
		
		Button.Transparency = 1
		Button.BillboardGui.Enabled = false
		Button.SetAttribute('Unlocked', true)
		
	end)
end

game.Players.PlayerAdded:Connect(function(player)
	
	
	local Tycoon = assignTycoon(player)
	if not Tycoon then warn("Could not assign tycoon to "..player.Name) return end
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local cash = Instance.new("IntValue")
	cash.Name = "Cash"
	cash.Value = 500
	cash.Parent = leaderstats

end)

@QwertyQwerty88 can you help out here?

2 Likes

:wave: Hey @sjordiemanders, welcome!

What is the error in the Output?

Probably because continue is not a keyword in Lua, but a keyword in Luau, Roblox’s programming language.

1 Like

the error is in the title that is all i get.
I am doing this in roblox but it still i can’t figure this out

No, the error will show line number.

Please send a screenshot of the Output.

1 Like

There is nothing …

Playtest the game, wait for it to error, and take a screenshot.

1 Like

i did that thats the screenshot

You didn’t do either of these.

here’s proof i did

You cleared the Output…

Look how did you know what the error was to put it in the title if it’s not in the Output?

i said that in my description i compiled the lua online every compiler was saying the same. My code isn’t working in game. I never said i am getting the error in game.

because your code isn’t lua, it’s LUAU. Those online compilers don’t know that continue is a keyword in luau.

I don’t have enough context to help here (that’s the thing about Roblox). can you send

  • all the scripts and what they do
  • screenshots of the explorer

and what exactly the game is about

then the syntax error is not the problem.

2 Likes

ok i understand those but all the code/script i have is in this topic here is a screenshot of it all:

Basicly what should happen is that when i click run the conveyor shouldn’t be there. I am working with tags So i made a Tag called Tycoon which i am calling in the code

Hope this helps sorry for the inconvenience…

Thanks for the screenshot and I am very sorry if I seemed a bit rude earlier.

I will look into this a little later when I have time.

1 Like

hey qwerty hope you doing ok.

did ou have the chance yet to look into it? or someone else?

Are you stepping on the button or clicking it? Because your code checks if you touch the button

I meant when i click on run to play on the client to test the sript it should let the conveyor dissapear but it doesn’t

oh :woman_facepalming: so lines 9-13? maybe put a print statement in the loop like print(Tycoon)

also be 100% sure that the Tycoon is tagged properly

the print doesn’t recognize Tycoon but it does Tycoons.

It is properly tagged though