local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lib = require(ReplicatedStorage:WaitForChild("Lib"))
local Knit = require(ReplicatedStorage.Packages:WaitForChild("Knit"))
local CameraShaker = require(ReplicatedStorage.Modules.CameraShaker)
local Camera = game.Workspace.CurrentCamera
local CamShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
Camera.CFrame = Camera.CFrame * shakeCf
end)
local AbilityFolder = script.Parent.Parent
local Assets = AbilityFolder:WaitForChild("Assets")
local MiracleDriveVoicelines = {
"Feel the power of my Miracle Drive Shot!",
"With this shot, victory is ours!",
"This is the true Argentine football!"
}
local Client = function(Player, Clone)
local Character = Clone
local CamController = Knit.GetController("CamController")
local EffectsController = Knit.GetController("EffectsController")
local Connections = {}
local Effects = {}
local Rig = Character
local CameraRig = Assets:FindFirstChild('Cam'):Clone()
CameraRig:PivotTo(Rig.HumanoidRootPart.CFrame - Vector3.new(0,3,0))
CameraRig.Parent = game.Workspace
local AnimController = CameraRig:WaitForChild("AnimationController")
local Animator = AnimController:WaitForChild("Animator")
local CamAnim = Animator:LoadAnimation(Assets.CameraAnimation)
CamAnim:Play()
CamController:Track(CameraRig.camera, 6.85)
local ScorpionBlock = Rig.Humanoid.Animator:LoadAnimation(Assets.CutsceneBlock)
ScorpionBlock:Play()
local function Cleanup()
CameraRig:Destroy()
for _, Connection in ipairs(Connections) do
Connection:Disconnect()
end
table.clear(Connections)
for _, Effect in ipairs(Effects) do
if Effect and Effect:IsA("Instance") then
Effect:Destroy()
end
end
table.clear(Effects)
end
Connections[1] = ScorpionBlock:GetMarkerReachedSignal('Smoke'):Connect(function()
Rig["Right Leg"].RightFootAttachment.Dirt:Emit(50)
Rig["Right Leg"].RightFootAttachment.Rocks:Emit(15)
end)
Connections[2] = ScorpionBlock:GetMarkerReachedSignal('Jump'):Connect(function()
Rig["Left Leg"].Fire.Enabled = true
Rig["Left Leg"].FireLight.Enabled = true
Rig["Left Leg"].Trail.Enabled = true
Rig["Left Leg"].Fire:Emit(30)
end)
Connections[3] = ScorpionBlock:GetMarkerReachedSignal('Hit'):Connect(function()
Rig["Left Leg"].Fire.Enabled = false
Rig["Left Leg"].FireLight.Enabled = false
Rig["Left Leg"].Trail.Enabled = false
Rig.Ball.Vfx.Fire:Emit(1)
Rig.Ball.Vfx.Fire2:Emit(1)
Rig.Ball.Vfx.Rocks:Emit(45)
CamShake:Shake(CameraShaker.Presets.Explosion)
end)
Connections[4] = ScorpionBlock:GetMarkerReachedSignal('Land'):Connect(function()
Rig["Right Leg"].RightFootAttachment.Dirt:Emit(15)
Rig["Right Leg"].RightFootAttachment.Rocks:Emit(15)
EffectsController:PlayDialouge("Dont call me the maid... it'/s all cleared up!", "Ghost", 2)
end)
task.delay(7, function()
Cleanup()
end)
end
return Client
^^^ client
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lib = require(ReplicatedStorage:WaitForChild("Lib"))
local Knit = require(ReplicatedStorage.Packages:WaitForChild("Knit"))
local AbilityFolder = script.Parent.Parent
local Assets = AbilityFolder:WaitForChild("Assets")
local Server = function(Player, HasBall)
local Character = Player.Character
if not Character then return end
local RootPart = Character:FindFirstChild("HumanoidRootPart")
local Humanoid = Character:FindFirstChild("Humanoid")
if not RootPart or not Humanoid then return end
local AbilityService = Knit.GetService("AbilityService")
local GameLoopService = Knit.GetService('GameLoopService')
local CamService = Knit.GetService("CamService")
local BallService = Knit.GetService("BallService")
GameLoopService:PauseTimer(true)
BallService:RemoveBallOwnership(Player, HasBall)
HasBall.Parent = script
local Clone = Assets:FindFirstChild("Rig"):Clone()
Clone:PivotTo(RootPart.CFrame)
Clone.Parent = workspace
Clone.Humanoid:ApplyDescription(Humanoid:GetAppliedDescription())
AbilityService.Client.Cutscene:FireAll(AbilityFolder.Cutscene.Client, {
Player,
Clone,
})
Character.Parent = script
task.delay(7, function()
if Character then
Character.Parent = workspace
HasBall.Parent = Character
BallService:GiveBallOwnership(Player, HasBall)
GameLoopService:PauseTimer(false)
else
HasBall.Parent = game.Workspace
end
if Clone then
Clone:Destroy()
end
end)
end
return Server
With these two scripts which control a cutscne I run into a race condition. I want allplayers to finish the cutscene at the same time right, now sometimes the player is put back into the workspace whilst the cutscene is still playing and visible
How can i fix this?