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

How do I add this to the boss battle script?

Asked by 2 years ago

Ok, so I’m making a boss battle in my game, now I am watching this video for reference and using the kit provided in it: https://www.youtube.com/watch?v=tCtVNGKu5FY

Now the problem is I want to make it so that when the boss is dead it awards you a badge, also I want to make it so that the boss battle doesn’t start unless you walk over a part and get inside the boss area (like you walk over a part and that triggers the boss to start the battle/boss attacks), how do I make such thing? (The script is found in the kit of the boss that is used in the video).

Please explain thoroughly as I’m a horrible scripter and still learning if you can!

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Alright, I'll answer for you.

So, to start off, you only want it to activate when a player walks over a part.

I won't watch the ENTIRE tutorial, so go ahead and correct me for any mistakes.

First of all, disable BossHandler in the boss. Then, disable the BossHealth GUI.

Then, make a part.

Insert this script:

local boss = workspace.BossNameHere -- Replace BossNameHere with the name of your boss (also make sure it's in the workspace)
local ts = game:GetService("TweenService")
local fadeTI = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)

for _, i in pairs(boss:GetDescendants()) do
    if i:IsA("BasePart") then
        i.Transparency = 1
    end
end

script.Parent.Touched:Connect(function(hit)
    if hit.Parent then
        if hit.Parent:FindFirstChild("Humanoid") then
            local plr = game.Players:FindFirstChild(hit.Parent.Name)

            if plr then
                for _, i in pairs(boss:GetDescendants()) do
                    if i:IsA("BasePart") and i.Name ~= "HumanoidRootPart" then
                        local t = ts:Create(i, fadeTI, {Transparency = 0})
                        t:Play()

                        t.Completed:Connect(function()
                            boss.Head.BossHealth.Enabled = true
                            boss.Head.BossHealth.BossHandler.Disabled = false
                        end)
                    end
                end
            end
        end
    end
end)

That's basically it. If you want an explanation, ask and I will gladly give.

0
It works more than perfectly, you're so amazing, thanks so so much!!! Ghostinee 27 — 2y
0
No problem! LikeableEmmec 470 — 2y
Ad

Answer this question