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

Expected 'end' (to close 'function' at line 530), got <eof> yet a parenthesis cause an error?

Hello guys, I'm having an error. Here is my code

--[[Driver Handling]]

	--Driver Sit	
	car.DriveSeat.ChildAdded:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
			--Distribute Client Interface
			print("Unanchored started")
			for i,part in pairs(script.Body.Value:GetChildren()) do
			if part:IsA("BasePart") then 
			part.Anchored = false
			end
			if part:IsA("Model") then
			for i, part2 in pairs(part:GetChildren()) do
			if part:IsA("BasePart") then 
			part.Anchored = false
			end
			end
			end
			end	
			print("Unanchored")
			local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			car.DriveSeat:SetNetworkOwner(p)
			local player = game.Players:playerFromCharacter(item.Part1.Parent)
			if player:GetRankInGroup(6227530) >= 3  then	
			local g=script.Parent["A-Chassis Interface"]:Clone()
			g.Parent=p.PlayerGui
		end
	end

Having this here, it provides me a Expected 'end' (to close 'function' at line 530), got and adding an a parenthesis at the end, making it "end)" underlines it red. What should I do?

2 comments

0

I think you forgot an "end)"

0

I think you also made a mistake on line 23 by using a nonexistent function called "playerFromCharacter" which I believe you meant "GetPlayerFromCharacter".

3 answers

You're missing an end) at the end of your script.

--[[Driver Handling]]

    --Driver Sit    
car.DriveSeat.ChildAdded:Connect(function(child)
	if child.Name== "SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent) ~= nil then
		--Distribute Client Interface
		print("Unanchored started")
		for i,part in pairs(script.Body.Value:GetChildren()) do
			if part:IsA("BasePart") then 
				part.Anchored = false
			end
			if part:IsA("Model") then
				for i, part2 in pairs(part:GetChildren()) do
					if part:IsA("BasePart") then 
						part.Anchored = false
						end
					end
				end
            end 
            print("Unanchored")
            local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
            car.DriveSeat:SetNetworkOwner(p)
            local player = game.Players:playerFromCharacter(item.Part1.Parent)
            if player:GetRankInGroup(6227530) >= 3  then    
            local g=script.Parent["A-Chassis Interface"]:Clone()
            g.Parent=p.PlayerGui
        end
    end
end)

1 comment

0

This bluelines the word "item" in "local player = game.Players:playerFromCharacter(item.Part1.Parent)" and provides me with the error "attempt to index nil with 'Part1'"

It says expected 'end' not parenthesis so you just do a simple

end

here:

--[[Driver Handling]]

    --Driver Sit    
    car.DriveSeat.ChildAdded:connect(function(child)
        if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
            --Distribute Client Interface
            print("Unanchored started")
            for i,part in pairs(script.Body.Value:GetChildren()) do
            if part:IsA("BasePart") then 
            part.Anchored = false
            end
            if part:IsA("Model") then
            for i, part2 in pairs(part:GetChildren()) do
            if part:IsA("BasePart") then 
            part.Anchored = false
            end
            end
            end
            end 
            print("Unanchored")
            local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
            car.DriveSeat:SetNetworkOwner(p)
            local player = game.Players:playerFromCharacter(item.Part1.Parent)
            if player:GetRankInGroup(6227530) >= 3  then    
            local g=script.Parent["A-Chassis Interface"]:Clone()
            g.Parent=p.PlayerGui
        end
    end

1 comment

0

I don't actually see a difference in my code and your code. Copy and pasting your code didn't fix it, and I still didn't see anything change.

--[[Driver Handling]]
--Driver Sit
car.DriveSeat.ChildAdded:connect(
    function(child)
        if
            child.Name == "SeatWeld" and child:IsA("Weld") and
                game.Players:GetPlayerFromCharacter(child.Part1.Parent) ~= nil
         then
            --Distribute Client Interface
            print("Unanchored started")
            for i, part in pairs(script.Body.Value:GetChildren()) do
                if part:IsA("BasePart") then
                    part.Anchored = false
                end
            end
            if part:IsA("Model") then
                for i, part2 in pairs(part:GetChildren()) do
                    if part:IsA("BasePart") then
                        part.Anchored = false
                    end
                end
            end
        end
        print("Unanchored")
        local p = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
        car.DriveSeat:SetNetworkOwner(p)
        local player = game.Players:playerFromCharacter(item.Part1.Parent)
        if player:GetRankInGroup(6227530) >= 3 then
            local g = script.Parent["A-Chassis Interface"]:Clone()
            g.Parent = p.PlayerGui
        end
    end
)

You were missing an end and a parenthesis to close the car.DriveSeat.ChildAdded:connect(

1 comment

0

This bluelines every line that says "part" and gives me an error, attempt to index nil with 'IsA'

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