Have I missed an end) or an end?

For some reason it keeps giving me errors, Telling me I missed an end. Thanks for any help!

--LeaderBoard Script:
game.Players.PlayerAdded:connect(function(p)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	stats.Parent = p

	local money = Instance.new("IntValue")
	money.Name = "Money" 
	money.Value = 10 -- You can change this to anything
	money.Parent = stats
	
	local Sell = game.Workspace.PlaceHolderSellPoint
	local Handle = game.ReplicatedStorage.Paper.Handle
	local Paper = Handle.Parent
	local Rarity = Handle.Rarity
	
	local function onPartTouched(Handle)
		print((Sell.Name .. " has touched " .. Handle.Name))
	if Rarity == "Common" then
		Paper:Destroy()	
		p.leaderstats.Money.Value = 2+
			Sell.Touched:Connect(onPartTouched)				
			
		if Rarity == "Common+" then
			Paper:Destroy()	
			p.leaderstats.Money.Value = 10+
				Sell.Touched:Connect(onPartTouched)	
			
		else if Rarity == "Rare" then
			Paper:Destroy()	
			p.leaderstats.Money.Value = 70+
				Sell.Touched:Connect(onPartTouched)	
			else if Rarity == "Rare+" then
				Paper:Destroy()	
				p.leaderstats.Money.Value = 170+
					Sell.Touched:Connect(onPartTouched)	
				else if Rarity == "Epic" then
					Paper:Destroy()	
					p.leaderstats.Money.Value = 500+
						Sell.Touched:Connect(onPartTouched)	
					else if Rarity == "Epic+" then
						Paper:Destroy()	
						p.leaderstats.Money.Value = 1250+
							Sell.Touched:Connect(onPartTouched)	
						else if Rarity == "Legendary" then
							Paper:Destroy()	
							p.leaderstats.Money.Value = 5000+
								Sell.Touched:Connect(onPartTouched)	
							else if Rarity == "Mythic" then
								Paper:Destroy()	 
								p.leaderstats.Money.Value = 30000+
									Sell.Touched:Connect(onPartTouched)	
	end						
end)																

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

could you just take a picture of the script in studio?

Like this?

pretty sure you missed 3 ends one with the function and one with the if thens

After first if you should write “else if” or “elseif” or it won’t work properly. I don’t see any missing end’s in your script though.

I only see the end) for the player added function

I did what you asked but there is still an error "Expected identifier When parsing expression, Got ‘end’

Did that, Still not working, I do believe there are missing ends but once i put them in the script still has errors with the ends

--LeaderBoard Script:
game.Players.PlayerAdded:connect(function(p)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	stats.Parent = p

	local money = Instance.new("IntValue")
	money.Name = "Money" 
	money.Value = 10 -- You can change this to anything
	money.Parent = stats

	local Sell = game.Workspace.PlaceHolderSellPoint
	local Handle = game.ReplicatedStorage.Paper.Handle
	local Paper = Handle.Parent
	local Rarity = Handle.Rarity

	local function onPartTouched(Handle)
		print((Sell.Name .. " has touched " .. Handle.Name))
		if Rarity == "Common" then

			Paper:Destroy()	
			p.leaderstats.Money.Value = 2+
				Sell.Touched:Connect(onPartTouched)				

			if Rarity == "Common+" then


				Paper:Destroy()	
				p.leaderstats.Money.Value = 10+
					Sell.Touched:Connect(onPartTouched)	

			elseif Rarity == "Rare" then
					Paper:Destroy()	
					p.leaderstats.Money.Value = 70+
						Sell.Touched:Connect(onPartTouched)	
				elseif Rarity == "Rare+" then
						Paper:Destroy()	
						p.leaderstats.Money.Value = 170+
							Sell.Touched:Connect(onPartTouched)	
					elseif Rarity == "Epic" then
							Paper:Destroy()	
							p.leaderstats.Money.Value = 500+
								Sell.Touched:Connect(onPartTouched)	
						elseif Rarity == "Epic+" then
								Paper:Destroy()	
								p.leaderstats.Money.Value = 1250+
									Sell.Touched:Connect(onPartTouched)	
							elseif Rarity == "Legendary" then
									Paper:Destroy()	
									p.leaderstats.Money.Value = 5000+
										Sell.Touched:Connect(onPartTouched)	
								elseif Rarity == "Mythic" then
										Paper:Destroy()	 
										p.leaderstats.Money.Value = 30000+
											Sell.Touched:Connect(onPartTouched)	
									end
								end

							


																			
	end
		
	end)

this should work

All ends you need to add have to be added at the end of this script. Not in the middle or somewhere else, first function wasn’t really function it was more of variables list.

1 Like

No errors, My script dosent work anymore. This is hell.

you’re not calling the function, pretty sure that’s why oh wait

1 Like

What do you mean, What function?

question what is PlaceHolderSellPoint

Its where you drop the paper into a part, Which is PlaceHolderSellPoint

wait wait I see a lot of weird things in your script

image
like this?

When the paper collides with the sellpoint, It deletes the paper and then increases money value by the rarity of the paper.

also
image
you’re calling the function inside the function

So what does that mean, Is that making my script not work?

yeah that is most likely why, honestly the first time I have seen a function being called inside itself

local function Hue()
-- function code
end)

part.Touched:Connect(Hue)


1 Like