Hello. I’m making a game that has a type of survival section. I tried starting it with firing a remote event (server) on a local script (where the cutscene happens). If any of you can help, i would be really happy!
- Configuring The Remote Event (Server Script in ServerScriptService) :
local rotation = CFrame.Angles(0, math.rad(90), 0)
local RotTentacle = CFrame.Angles(0, math.rad(180), 0)
local CanAttack = true
local function selectPlayer()
local players = game.Players:GetPlayers()
local selected = players[math.random(1,#players)]
return selected
end
local function TearDropAttack()
local TearDropModel = game.ReplicatedStorage.BossFightAttacks.TearDropAttack:Clone()
CanAttack = false
TearDropModel.Parent = workspace
wait(3)
TearDropModel:WaitForChild("AlertParts"):Destroy()
game:GetService("TweenService"):Create(TearDropModel.PrimaryPartBase, TweenInfo.new(1), {Position = workspace.TearDropFallenCFrame.Position}):Play()
wait(1.1)
CanAttack = true
end
local function BallAttack(PlayerSelected)
local Ball = game.ReplicatedStorage.BossFightAttacks.SlimeBallAttack:Clone()
CanAttack = false
Ball.Parent = workspace
game:GetService("TweenService"):Create(Ball, TweenInfo.new(2), {Position = PlayerSelected.Character.HumanoidRootPart.Position}):Play()
wait(2.1)
CanAttack = true
Ball:Destroy()
end
local function TentacleSmackAttack(PlayerSelected)
local Tentacle = game.ReplicatedStorage.BossFightAttacks.TentacleSlam:Clone()
local Anim = Tentacle.AnimationController.Animator:LoadAnimation(script.SlamAnim)
CanAttack = false
Tentacle.Parent = workspace
Tentacle.Tentacle.Orientation = PlayerSelected.Character.Head.Orientation
game:GetService("TweenService"):Create(Tentacle.Tentacle, TweenInfo.new(2), {Position = Tentacle.TentacleAppearPos.Position}):Play()
wait(2.1)
Tentacle.Tentacle.Orientation = Tentacle.Tentacle.Orientation * RotTentacle
Anim:Play()
Anim.Ended:Wait()
print("Attack Finished")
wait(1)
game:GetService("TweenService"):Create(Tentacle.Tentacle, TweenInfo.new(1), {Position = Tentacle.TentacleDissapearPos.Position}):Play()
wait(1.1)
CanAttack = true
Tentacle:Destroy()
end
local function TentacleSpinAttack(PlayerSelected)
local Tentacle = game.ReplicatedStorage.BossFightAttacks.TentacleSpin:Clone()
local Anim = Tentacle.AnimationController.Animator:LoadAnimation(script.SpinAnim)
CanAttack = false
Tentacle.Parent = workspace
Tentacle.Tentacle.Orientation = Tentacle.Tentacle.Orientation * rotation
game:GetService("TweenService"):Create(Tentacle.Tentacle, TweenInfo.new(2), {Position = Tentacle.TentacleAppearPos.Position}):Play()
wait(2.1)
Anim:Play()
Anim.Ended:Wait()
print("Attack Finished")
wait(1)
game:GetService("TweenService"):Create(Tentacle.Tentacle, TweenInfo.new(1), {Position = Tentacle.TentacleDissapearPos.Position}):Play()
wait(1.1)
CanAttack = true
Tentacle:Destroy()
end
game.ReplicatedStorage.BossFightEvent.OnServerEvent:Connect(function()
local RandomPlayer = nil
TearDropAttack()
wait(6)
RandomPlayer = selectPlayer()
BallAttack(RandomPlayer)
workspace.BossfightTenebris.Cube.CFrame = CFrame.lookAt(workspace.BossfightTenebris.Cube.Position, RandomPlayer.Character.HumanoidRootPart.Position)
wait(4)
RandomPlayer = selectPlayer()
TentacleSmackAttack(RandomPlayer)
workspace.BossfightTenebris.Cube.CFrame = CFrame.lookAt(workspace.BossfightTenebris.Cube.Position, RandomPlayer.Character.HumanoidRootPart.Position)
wait(6)
RandomPlayer = selectPlayer()
TentacleSpinAttack(RandomPlayer)
workspace.BossfightTenebris.Cube.CFrame = CFrame.lookAt(workspace.BossfightTenebris.Cube.Position, RandomPlayer.Character.HumanoidRootPart.Position)
wait(5)
print("Ended")
end)
- Additional Screenshots
[This is on a LocalScript]
- Extra Information
The Remote Event Is Called StartBossFight Because I Wanted It To Be A Boss Fight. But I Decided Making It A Survival Section During Scripting.
I’m Not Getting Any Errors!
[Okay That’s Everything! If any of you can help me i would be really thankful!]