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

How to fix end of finish error in my script in lua in roblox studio in my local script at line 16?

So I'm getting this error, 19:48:19.203 - Players.MrMeeper9.Backpack.LocalScript:36: Expected ')' (to close '(' at line 16), got , how to fix?

repeat wait() until game.Players.LocalPlayer.Character
local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Mouse = Plr:GetMouse()
local CouldGetLeaves = true

function ShowProgress(Leaves)
 if CouldGetLeaves == "Leaves" then
  for i = 0,1,.01 do
   WC.BG.Bar.Progress.Size = UDim2.new(i,0,1,0)
   wait()
  end
  end
 end

Mouse.Button1Down:connect(function()
 if Mouse.Target ~= nil and Mouse.Target.Parent.Name == "Leaves" and CouldGetLeaves == true then
  local Wood = Mouse.Target
  if (Wood.Position - Char.UpperTorso.Position).magnitude < 10 then
   CouldGetLeaves = false
   WC = Plr.PlayerGui.WoodChopper
   WC.BG.Visible = true
   Char.Humanoid.WalkSpeed = 0
   ShowProgress ("Leaves")
   Char.Humanoid.WalkSpeed = 16
   for i,v in pairs(Wood.Parent.Leaves:GetChildren())do
    if v:IsA("Leaves") then
     v.Anchored = false
    end
   end
end
   Wood:Destroy()
   WC.BG.Visible = false
   CouldGetLeaves = true
  end
 end

3 comments

0

Is it a TextButton or a ClickDetector?

0

Its in a local script in startpack

0

I've resolved your program.

1 answer

✓ Accepted answer

The exception that was raised was an EOF or End of File. It is usually cause by an open parenthesis missing it's partner, and the compiler reached the end of the Script trying to look for it. This of which is your case; your Connect method's argumental parentheses weren't closed, therefore your code is reading:

Mouse.Button1Down:Connect(

To solve this issue, make sure to enclose the parentheses next time.

local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()

local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local PlayerGui = Player:WaitForChild("PlayerGui")
local WoodChopper = PlayerGui:WaitForChild("WoodChopper")
local ChopperBackground = WoodChopper:WaitForChild("BG")
local ChopperBar = ChopperBackground:WaitForChild("Bar")
local ChopProgress = ChopperBar:WaitForChild("Progress")

local CanGetLeaves = true

local function ShowProgress(Leaves)
	if (Leaves == "Leaves") then
		local Direction = Enum.EasingDirection.Out
		local Style = Enum.EasingStyle.Linear
		ChopProgress:TweenSize(UDim2.new(1,0,1,0), Direction, Style, 1, true)
	end
end

Mouse.Button1Down:Connect(function()
	local Wood = Mouse.Target
	if (Wood and Wood.Parent.Name == "Leaves" and CanGetLeaves) then
		if (Player:DistanceFromCharacter(Wood.Position) < 10) then
			ChopperBackground.Visible = true
			Humanoid.WalkSpeed = 0
			ShowProgress("Leaves")
			Humanoid.WalkSpeed = 16
			for _,Leaf in pairs(Wood.Parent.Leaves:GetChildren()) do
				if Leaf:IsA("Leaves") then
					Leaf.Anchored = false
				end
			end
		end
		Wood:Destroy()
   		BG.Visible = false
		CanGetLeaves = true
	end
 end)

If that helped, don't forget to accept this answer!

4 comments

0

This only created a bit more problems. At first it made some errors then I reverted it back to the old code then back to this. Now some are underlined in blue and when clicked the tree it just freezes/anchors the character which is not supposed to happen.

0

These issues aren't of my doing, these are resulting from your code containing more errors that weren't able to be caught due to the thread previously closing because of your EOF.

0

I cannot help you if you do not provide your full script.

0

I provided the full script just now after realizing some things

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