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

i want to make this "beam" damage stuff like a HumanoidRootPart of a dummy what do i change?

Asked by 1 year ago
Edited 1 year ago

Here the script the main part is where it damage is tho it doesnt have to damage other players

while true do
    local BeamColor = script.Parent.Settings.BeamColor.Value
    local InnerBeamColor = script.Parent.Settings.InnerBeamColor.Value
    local beamdistance = script.Parent.Settings.BeamDistance.Value
    local MainEyeColor = script.Parent.Settings.MainEyeColor.Value
    local EyeColor = script.Parent.Settings.EyeColor.Value
    local EyeColor2 = script.Parent.Settings.EyeColor2.Value
    local ExplosionColor = script.Parent.Settings.ExplosionColor.Value
    local p = Instance.new("Part", script.Parent)
    p.Name = "ChargingAura"
    p.Anchored = true
    p.CFrame = script.Parent.BeamCharging.CFrame
    p.Shape = Enum.PartType.Ball
    p.Size = Vector3.new(script.Parent.BeamCharging.Size.X * 3, script.Parent.BeamCharging.Size.X * 3, script.Parent.BeamCharging.Size.X * 3)
    p.Material = Enum.Material.Neon
    p.Transparency = 0.5
    p.CanCollide = false
    p.Color = BrickColor.new("Institutional white").Color -- the charging ball thing color
    script.Parent.Beamer.Charge:Play()
    for i = 1,5 do
        script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(-2.25), math.rad(0), math.rad(0))
        wait(0.01)
    end
    for i = 1,5 do
        script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(2.25), math.rad(0), math.rad(0))
        wait(0.01)
    end
    for i = 1,27 do
        p.Size = p.Size - Vector3.new(script.Parent.BeamCharging.Size.X * 0.15, script.Parent.BeamCharging.Size.X * 0.15, script.Parent.BeamCharging.Size.X * 0.15)
        p.Transparency = p.Transparency - 0.0375
        p.Color = BrickColor.new("Institutional white").Color -- the charging ball thing color
        script.Parent.Head.CFrame = script.Parent.Head.CFrame * CFrame.Angles(math.rad(-0.5), math.rad(0), math.rad(0))
        script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(2.25), math.rad(0), math.rad(0))
        wait(0.01)
    end
    game.Debris:AddItem(p, 0.5)
    for i = 1, 2 do
        script.Parent.Head["Right Eye"].Transparency = script.Parent.Head["Right Eye"].Transparency+0.5
        wait(0.000)
    end
    wait(0.1)
    script.Parent.BeamCharging.Transparency = 1
    local c = Instance.new("Part", script.Parent)
    c.Name = "GasterBeam"
    c.BrickColor = InnerBeamColor
    c.Anchored = true
    c.CanCollide = false
    c.Shape = Enum.PartType.Cylinder
    c.Size = Vector3.new(beamdistance, script.Parent.BeamCharging.Size.Y * 3.3, script.Parent.BeamCharging.Size.Z * 3.3)
    c.CFrame = script.Parent.BeamCharging.CFrame + script.Parent.BeamCharging.CFrame.RightVector * ((c.Size.X / 2) + (script.Parent.BeamCharging.Size.X * 1.5))
    c.Material = Enum.Material.Neon
    c.Transparency = 0.35
    local c2 = c:Clone()
    c2.Parent = c.Parent
    c2.Name = "GasterBeam2"
    c2.BrickColor = BeamColor
    c2.Material = Enum.Material.Neon
    c:GetPropertyChangedSignal("CFrame"):Connect(function()
        c2.CFrame = c.CFrame
    end)
    c:GetPropertyChangedSignal("Size"):Connect(function()
        c2.Size = c.Size + Vector3.new(0,c.Size.Y/2.2,c.Size.Z/2.2)
    end)
    c:GetPropertyChangedSignal("Transparency"):Connect(function()
        c2.Transparency = c.Transparency
    end)
    if script.Parent.Settings.KR.Value == true then do
            debounce = true
            c.Touched:Connect(function(hit)
                local player = hit.Parent
                local Owner = script.Parent.Owner
                if player.Name == Owner.Value then
                else
                    if player:FindFirstChild("Humanoid") and  debounce == true then
                        debounce = false    
                        for i = 1, 10 do
                            hit.Parent:FindFirstChild("Humanoid"):TakeDamage(script.Parent.Settings.Damage.Value)
                            wait(0.01)
                        end
                        debounce = true
                    end
            end
        end)
    end
        c.Touched:Connect(function(hit)
            local player = hit.Parent
            local Owner = script.Parent.Owner
            if player.Name == Owner.Value then
            else
                if player:FindFirstChild("Humanoid") and debounce == true then
                    player.Humanoid:TakeDamage(45)
                end
                debounce = true
            end)
        end
    end
    -- script.Parent["Right Eye"].Transparency = 1
    script.Parent.Beamer.Shoot:Play()
    script.Parent.Beamer.Charge:Stop()
    script.Parent.Head["Left Eye"].BadTime.Enabled = true
    local EEE = c.Size.Y / 15
    for i = 1,7 do
        for i = 1,5 do
            c.Size = c.Size + Vector3.new(0,EEE,EEE)
            script.Parent.Head["Left Eye"].Color = EyeColor
            script.Parent.Head["Right Eye"].Transparency = script.Parent.Head["Right Eye"].Transparency-0.2
            script.Parent.Head["Left Eye"].Transparency = script.Parent.Head["Left Eye"].Transparency+0.2
            script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(0.5), math.rad(0), math.rad(0))
            script.Parent.Head.CFrame = script.Parent.Head.CFrame * CFrame.Angles(math.rad(-0.5), math.rad(0), math.rad(0))
            wait(0.03)
        end
        for i = 1,5 do
            script.Parent.Head["Left Eye"].Color = EyeColor2
            script.Parent.Head["Right Eye"].Transparency = script.Parent.Head["Right Eye"].Transparency+0.2
            script.Parent.Head["Left Eye"].Transparency = script.Parent.Head["Left Eye"].Transparency-0.2
            script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(-0.5), math.rad(0), math.rad(0))
            script.Parent.Head.CFrame = script.Parent.Head.CFrame * CFrame.Angles(math.rad(0.5), math.rad(0), math.rad(0))
            c.Size = c.Size - Vector3.new(0,EEE,EEE)
            wait(0.03)
        end
    end
    for i = 1,15 do
        script.Parent.Head["Left Eye"].Color = MainEyeColor
        script.Parent.Head["Right Eye"].Transparency = script.Parent.Head["Right Eye"].Transparency+0.2
        script.Parent.Head["Left Eye"].Transparency = script.Parent.Head["Left Eye"].Transparency-0.2
        script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(-0.5), math.rad(0), math.rad(0))
        script.Parent.Head.CFrame = script.Parent.Head.CFrame * CFrame.Angles(math.rad(0.5), math.rad(0), math.rad(0))
        c.Transparency= c.Transparency + 0.05
        c.Size = c.Size - Vector3.new(0,0.3,0.3)
        wait(0.03)
        end
    for i = 1,1 do
        script.Parent.Head["Right Eye"].Transparency = script.Parent.Head["Right Eye"].Transparency + 1
        wait(0.000)
    end
    for i = 1,10 do
        c.Size = c.Size - Vector3.new(0,EEE*1.2,EEE*1.2)
        c.Transparency = c.Transparency + 1
        script.Parent.Head["Left Eye"].Transparency = 1
        wait(0.035)
    end
    script.Parent.Head["Left Eye"].BadTime.Enabled = false
    game.Debris:AddItem(c, 0)
    game.Debris:AddItem(c2, 0)
    --script.Parent["Right Eye"].Transparency = 0
    for i = 1,30 do
        script.Parent.Head.CFrame = script.Parent.Head.CFrame * CFrame.Angles(math.rad(0.5), math.rad(0), math.rad(0))
        script.Parent.Jaws.CFrame = script.Parent.Jaws.CFrame * CFrame.Angles(math.rad(-2.15), math.rad(0), math.rad(0))
        script.Parent.Head["Inner Eye"].Transparency = script.Parent.Head.Transparency + 0.05
        script.Parent.Head.Transparency = script.Parent.Head.Transparency + 0.033
        script.Parent.Jaws.Transparency = script.Parent.Jaws.Transparency + 0.033
        script.Parent.BeamCharging.Transparency = script.Parent.BeamCharging.Transparency - 0.033
        script.Parent.BeamCharging.Size = script.Parent.BeamCharging.Size + Vector3.new(script.Parent.BeamCharging.Size.X * 0.08, script.Parent.BeamCharging.Size.X * 0.08, script.Parent.BeamCharging.Size.X * 0.08)
        script.Parent.BeamCharging.Color = ExplosionColor
        wait(0.01)
    end

    for i = 1, 20 do
        script.Parent.BeamCharging.Transparency = script.Parent.BeamCharging.Transparency + 0.05
        wait()
    end
    wait(0.5)
    script.Parent:Destroy()
end
0
the code is messy wth T3_MasterGamer 2189 — 1y
0
sorry its not mine tho G4BR13L_progamer123 5 — 1y

1 answer

Log in to vote
0
Answered by
lamgogo 56
1 year ago
Edited 1 year ago

at line 72 - 78:

if player.Name == Owner.Value then
else
if player:FindFirstChild("Humanoid") and  debounce == true then
                debounce = false    
                for i = 1, 10 do
                    hit.Parent:FindFirstChild("Humanoid"):TakeDamage(script.Parent.Settings.Damage.Value)
                    wait(0.01)
                end
                debounce = true
end

alright 85 - 95:

c.Touched:Connect(function(hit)
                local player = hit.Parent
                local Owner = script.Parent.Owner
if player.Name == Owner.Value then
else
                if player:FindFirstChild("Humanoid") and debounce == true then
                    player.Humanoid:TakeDamage(45)
   end
                debounce = true
end
end)

Fixed,if there are still errors in output tell me ok?

I think the problem in ur script that cant do damage is:The statement "if ... then"" can only handle 2 conditions,i have encountered this problem,and after fixed it i was like "Bruh why dont roblox tell people about that and try smth to prevent people to use more than 2 conditions?"

if u dont get it, this is what i mean:

if A == B and A == C then
--do things
end

This is 2 conditions, that are "A == B" and "A == C"

And maybe roblox cant handle this:

if A == B and A == C and C == D then

end

And this is more than 2 conditions added to "if" statement(up there)

Idk if this is the main problem,cuz the beam doesnt do damages so i checked damaging stuffs in the script,this is the only thing i found after reading and im not very sure is thats the problem tho,hope it will work ;)

0
Ok thanks ill check it rq G4BR13L_progamer123 5 — 1y
0
Tho are you sure that the second part of script isnt from 85-93 cause there is debounce = true even there G4BR13L_progamer123 5 — 1y
0
it says excepcted ) at line 85 G4BR13L_progamer123 5 — 1y
0
can u repost the code after fixed?i wrote it on web so there will be some funny mistake lol lamgogo 56 — 1y
View all comments (6 more)
0
Sure thing G4BR13L_progamer123 5 — 1y
0
i putted the new code "fixed" G4BR13L_progamer123 5 — 1y
0
done,be sure to read again lamgogo 56 — 1y
0
thanks ill check it rn G4BR13L_progamer123 5 — 1y
0
so uh im kinda confused but kinda got it so uh what would the final script be like G4BR13L_progamer123 5 — 1y
0
uh i see now. G4BR13L_progamer123 5 — 1y
Ad

Answer this question