Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

So I'm getting this error, 19:48:19.203 - Players.MrMeeper9.Backpack.LocalScript:36: Expected ')' (to close '(' at line 16), got <eof>, 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
0
Is it a TextButton or a ClickDetector? JB_SuperGamer 165 — 4y
0
Its in a local script in startpack MrMeeper9 39 — 4y
0
I've resolved your program. Ziffixture 6913 — 4y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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!

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. MrMeeper9 39 — 4y
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. Ziffixture 6913 — 4y
0
I cannot help you if you do not provide your full script. Ziffixture 6913 — 4y
0
I provided the full script just now after realizing some things MrMeeper9 39 — 4y
Ad

Answer this question