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

Unexpected Symbol Error?

Asked by 8 years ago

****EDIT:**** I solved this particular error myself.

I'm getting an unexpected symbol error with this script that I can't pinpoint the cause of:

local tool = script.Parent
local user
local IgnoreList = {"Handle", "Hat"}


tool.Equipped:connect(function(mouse)

   user = tool.Parent 


   mouse.Button1Down:connect(function()

      local ray = Ray.new(tool.AimPart.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300)
      local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, user)


      local playerhit = game.Players:GetPlayerFromCharacter(hit.Parent) or game.Players:GetPlayerFromCharacter(hit.Parent.Parent)
      if playerhit then
      local humanoid = playerhit.Character.Humanoid
      print(hit.Name)
      if humanoid then
           if hit.Name == "Head" then
            humanoid:TakeDamage(100)
            else
            humanoid:TakeDamage(30)
            end
       end

        -- Settings
       local distance = (position - tool.AimPart.CFrame.p).magnitude
       local rayPart = Instance.new("Part", user)
       rayPart.Name          = "RayPart"
       rayPart.BrickColor    = BrickColor.new("Really blue")
       rayPart.Parent        = game.Workspace
       rayPart.Transparency  = 0.5
       rayPart.Anchored      = true
       rayPart.CanCollide    = false
       rayPart.TopSurface    = Enum.SurfaceType.Smooth
       rayPart.BottomSurface = Enum.SurfaceType.Smooth
       rayPart.formFactor    = Enum.FormFactor.Custom
       rayPart.Size          = Vector3.new(0.2, 0.2, distance)
       rayPart.CFrame        = CFrame.new(position, tool.AimPart.CFrame.p) * CFrame.new(0, 0, -distance/2)

       game.Debris:AddItem(rayPart, 0.1)
   end)
end)

According to the output log, the problem occurs at line 45. How do I fix this?

Answer this question