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

Error on line 20 Expected <eof>, got 'end'?

Line 20 Expected <eof>, got 'end'

Any fix to this? Can't seem to figure what is wrong.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAppearanceLoaded:Connect(function(character)
	player.Chatted:Connect(function(msg)
		msg = msg:lower()
		if (msg == "money") then
			if (player.Character ~= nil) then
		        local humanoid = character:WaitForChild("Humanoid")
			        if player.Name == "LoganboyInCO" then
			            humanoid:AddAccessory(game.ReplicatedStorage.moneyrain) 
							end
					        humanoid.Died:Connect(function()
					            character:FindFirstChild("moneyrain").Parent = game.ReplicatedStorage
								game.ReplicatedStorage.moneyrain:Clone()	
							end)
						end
					end
				end)
			end)
        end)
    end)
end)

wow i hate autism

1 answer

✓ Accepted answer

functions with their structures defined as (function() have a parenthesis at the end, if statements have their code blocks end as end not end).

game.Players.PlayerAdded:Connect(function(player)
    	player.CharacterAppearanceLoaded:Connect(function(character)
	    player.Chatted:Connect(function(msg)
	        local msg = msg:lower()
	        if (msg == "money") then
	            if (player.Character ~= nil) then
	                local humanoid = character:WaitForChild("Humanoid")

	                    if player.Name == "LoganboyInCO" then
	                        humanoid:AddAccessory(game.ReplicatedStorage.moneyrain) 
	                     end

	                            humanoid.Died:Connect(function()
	                               character:FindFirstChild("moneyrain").Parent = 
game.ReplicatedStorage
	                              game.ReplicatedStorage.moneyrain:Clone()    
	                           end)
	                       end
	                   end
	               end
	           end
	     end)
	end)
end)

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