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

How To Make This Boss Battle Script Only Happen To Specific Players Who touch A Block?

Asked by 3 years ago

I want to make it so that if a player touches an object then a boss battle script runs for them and them only, (Boss Battle Script by Poncho Kings.) The Boss Battle Script is in the Server Script Service and the touch script is in a block in the Workspace, the Boss Battle Script is disabled until the block is touched.

(Boss Battle Script)

local function fireballChallenge()

    for i = 1,3 do

        for i,player in pairs(game.Players:GetPlayers()) do
            if player.Character then
                local fireball = game.ReplicatedStorage.Fireball:Clone()
                local fireball2 = game.ReplicatedStorage.Fireball2:Clone()
                local fireball3 = game.ReplicatedStorage.Fireball3:Clone()
                local fireball4 = game.ReplicatedStorage.Fireball4:Clone()
                local fireball5 = game.ReplicatedStorage.Fireball5:Clone()
                local target = game.ReplicatedStorage.Target:Clone()
                local target2 = game.ReplicatedStorage.Target2:Clone()
                local target3 = game.ReplicatedStorage.Target3:Clone()
                local target4 = game.ReplicatedStorage.Target4:Clone()
                local target5 = game.ReplicatedStorage.Target5:Clone()

                target.Parent = game.Workspace
                target.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0,3,0)) * CFrame.Angles(0,0,math.rad(90))
                target2.Parent = game.Workspace
                target2.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(-20,3,0)) * CFrame.Angles(0,0,math.rad(90))
                target3.Parent = game.Workspace
                target3.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(20,3,0)) * CFrame.Angles(0,0,math.rad(90))
                target4.Parent = game.Workspace
                target4.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0,3,20)) * CFrame.Angles(0,0,math.rad(90))
                target5.Parent = game.Workspace
                target5.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0,3,-20)) * CFrame.Angles(0,0,math.rad(90))

                wait(0.5)

                fireball.Parent = game.Workspace
                fireball.CFrame = target.CFrame + Vector3.new(0,30,0)
                fireball2.Parent = game.Workspace
                fireball2.CFrame = target.CFrame + Vector3.new(20,30,0)
                fireball3.Parent = game.Workspace
                fireball3.CFrame = target.CFrame + Vector3.new(-20,30,0)
                fireball4.Parent = game.Workspace
                fireball4.CFrame = target.CFrame + Vector3.new(0,30,20)
                fireball5.Parent = game.Workspace
                fireball5.CFrame = target.CFrame + Vector3.new(0,30,-20)

                wait(2)

                target:Destroy()
                target2:Destroy()
                target3:Destroy()
                target4:Destroy()
                target5:Destroy()
            end
        end
        wait(1)
    end
end

while wait(5) do

    fireballChallenge()

end

(Touched Script)

local block1 = game.Workspace.FrontBlock5
local block2 = game.Workspace.FrontBlock6
local block3 = game.Workspace.BackBlock5
local block4 = game.Workspace.BackBlock6
local BossBaconCell = game.Workspace.BossBaconCell
local Players = game:GetService("Players")

script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        wait(0.5)
        block1.CanCollide = true
        block2.CanCollide = true
        block3.CanCollide = true
        block4.CanCollide = true    

        BossBaconCell.Part10.CanCollide = false
        BossBaconCell.Part11.CanCollide = false
        BossBaconCell.Part12.CanCollide = false
        BossBaconCell.Part9.CanCollide = false

        game.ServerScriptService.BossFightScript.Disabled = false
        if game.Workspace.FrontBlock5.CanCollide == false then
            wait(10)
        end
    end
end)

How would I make it so that the Boss Battle Script only runs for the person who touches the block? Please Help.

Thank you!

0
ok listen that boss is perfect on its own why make it even harder to script? also is it a game script? so i can add it in my game superkitty444444 10 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

ok listen that boss is perfect on its own why make it even harder to script? also is it a game script? so i can add it in my game. Also its pretty simple make the block a button then insert the script in then add a script that makes it so when you click the button it sends you into the boss

0
I want to make it so that the fireball only targets the player that touched the block. MrSarp_shoot 37 — 3y
0
It's a serverscript service script MrSarp_shoot 37 — 3y
Ad

Answer this question