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

Can someone fix this tool?

Asked by 8 years ago

I need help making this tool, the script was made by a person in another of my questions! Thanks in advance, jakei181

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild('Head') and game.Players.LocalPlayer:GetMouse()
local plr = game.Players.LocalPlayer
local char = plr.Character
local head = char.Head
local mouse = plr:GetMouse()
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer

tool.Equipped:connect(function(mouse)
    print("Tool equipped!")

    mouse.Button1Down:connect(function()
        print("Mouse pressed!")
            local s,f = tool.Handle.CFrame,mouse.Hit.p
            local hit,pos = workspace:FindPartOnRayWithIgnoreList(Ray.new(s,(f-s).unit*999),char:children())
            local dist = (s-pos).magnitude
            local lastp = s
            for i = 1,10 do
                local newp = (CFrame.new(s,pos)*CFrame.new(0,0,-i*(dist/10))).p+Vector3.new(math.random(-25,25)/20,math.random(-25,25)/20,math.random(-25,25)/20)
                local newdist = (lastp-newp).magnitude
                local p = Instance.new('Part',char) game:service('Debris'):AddItem(p,.5)
                p.Material = 'Neon'
                p.Anchored = true
                p.CanCollide = false
                p.TopSurface = 0
                p.BottomSurface = 0
                p.formFactor = 3
                p.Reflectance = .3
                p.Transparency = .3
                p.BrickColor = BrickColor.new('Cyan')
                p.Size = Vector3.new(.2,.2,newdist)
                p.CFrame = CFrame.new(lastp,newp)*CFrame.new(0,0,-newdist/2)
                lastp = newp
            end
        end)
    end

The tool layout is here

0
What are your expectations for the code and how is it not meeting them? Goulstem 8144 — 8y
0
The lightning code isn't working jakei181 60 — 8y
0
Also, there are no errors jakei181 60 — 8y

Answer this question