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

Help ! the last END in my script is underlined in red , i don't know how to fix it.?

Asked by 4 years ago
```lua
local cando = true
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local oGUI = script:FindFirstChild("ScreenGui")


tool.Equipped:Connect(function(mouse)

    local GUI = oGUI:Clone()
GUI.Parent = player.PlayerGui
    wait(1)
    GUI.Enabled = false

    mouse.Button1Down:connect(function()
        cando = false 
        local ray = Ray.new(tool.Glowstone.CFrame.p, (mouse.Hit.p - tool.Glowstone.CFrame.p).unit * 400)
        local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
        local beam = Instance.new("Part",workspace)

        beam.FormFactor = "Custom"
        beam.Material = "Ice"
        beam.BrickColor = BrickColor.new("Cyan")
        beam.CanCollide = false
        beam.Anchored = true
        beam.Transparency = 0.15
        beam.Locked = true
        local distance = (tool.Glowstone.CFrame.p - position).magnitude
        beam.Size = Vector3.new(0.3,0.3,distance)
        beam.CFrame = CFrame.new(tool.Glowstone.CFrame.p, position) * CFrame.new(0,0, -distance /2)
        game:GetService("Debris"):AddItem(beam, 0.1)
        if part then

            local human = part.Parent:FindFirstChild("Humanoid")
            if not human then
                human = part.Parent.Parent:FindFirstChild("Humanoid")
                end
            if human then

               human:TakeDamage(3)
               human.WalkSpeed = 1

               wait(5)



            end
        end
    end)
end
end)
```

This a local script, it's also a tool

1 answer

Log in to vote
0
Answered by 4 years ago

Fixed: here.

local cando = true
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local oGUI = script:FindFirstChild("ScreenGui")


tool.Equipped:Connect(function(mouse)

    local GUI = oGUI:Clone()
GUI.Parent = player.PlayerGui
    wait(1)
    GUI.Enabled = false

    mouse.Button1Down:connect(function()
        cando = false 
        local ray = Ray.new(tool.Glowstone.CFrame.p, (mouse.Hit.p - tool.Glowstone.CFrame.p).unit * 400)
        local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
        local beam = Instance.new("Part",workspace)

        beam.FormFactor = "Custom"
        beam.Material = "Ice"
        beam.BrickColor = BrickColor.new("Cyan")
        beam.CanCollide = false
        beam.Anchored = true
        beam.Transparency = 0.15
        beam.Locked = true
        local distance = (tool.Glowstone.CFrame.p - position).magnitude
        beam.Size = Vector3.new(0.3,0.3,distance)
        beam.CFrame = CFrame.new(tool.Glowstone.CFrame.p, position) * CFrame.new(0,0, -distance /2)
        game:GetService("Debris"):AddItem(beam, 0.1)

        if part then
            local human = part.Parent:FindFirstChild("Humanoid")
            if not human then
                human = part.Parent.Parent:FindFirstChild("Humanoid")
            end
            if human then
               human:TakeDamage(3)
               human.WalkSpeed = 1
               wait(5)
            end
        end


    end)--mouse button1 event
end)--tool equiped event

0
thanks gamer Redyblazeyy 31 — 4y
0
anytime! User#23252 26 — 4y
Ad

Answer this question