Cinematic event help

How would i make this only play for the player and the enemy?
heres the part where i fire the script FROM A SERVER SCRIPT:

cut:FireAllClients(Character,enemy)

Heres where its recieved, a local script in starterCharacterscripts:

local RunService = game:GetService("RunService")

local RemoteEvent = game.ReplicatedStorage.Events.CUTSCENE
--local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

local Camera = workspace.Camera

local function Cinematic(Player,enemy)
    local Character = Player
    local CinematicsFolder = game.Lighting.Actualscene_Camera -- Path to your folder! 

    local CurrentCameraCFrame = workspace.CurrentCamera.CFrame

    Camera.CameraType = Enum.CameraType.Scriptable
    local FrameTime = 0
    local Connection

    Connection = RunService.RenderStepped:Connect(function(DT)
        local NewDT = DT * 60
        FrameTime += NewDT
        local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
        if NeededFrame then
            Character.Humanoid.AutoRotate = false
            Camera.CFrame = Character.HumanoidRootPart.CFrame * NeededFrame.Value
        else
            Connection:Disconnect()
            Character.Humanoid.AutoRotate = true
            Camera.CameraType = Enum.CameraType.Custom
            Camera.CFrame = CurrentCameraCFrame    
        end
    end)
end


RemoteEvent.OnClientEvent:Connect(Cinematic)
    

What is your problem with cinematic? is a played for every player or cinematic isn’t working anyway

Yes it played for EVERY character, when i only need it for the person hit (enemy) and the character

:FireClient(playerInstance) for both your player and enemy, assuming this enemy is an actual player.
:FireAllClients() does not take any parameters and it fires for every client in your server.

Alright, Il try it out in a moment!

I did FireClient(character) and it came out withL

 FireClient: player argument must be a Player object  ```

What do ya mean by player instance

A Player.

You’re passing a Character instead of a Player, as clearly seen:

You need to use :GetPlayerFromCharacter() to get the “Client” argument of :FireClient()

2 Likes

Ive done this,

cut:FireClient(player)

The Player is defined above and thats how the character is accesed. In the Local script, it cannot seem to find the character after its been passed

local RunService = game:GetService("RunService")

local RemoteEvent = game.ReplicatedStorage.Events.CUTSCENE
--local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

local Camera = workspace.Camera

local function Cinematic(Player)
	
	local Character = Player:WaitForChild("Character")
	local CinematicsFolder = game.Lighting.Actualscene_Camera -- Path to your folder! 

	local CurrentCameraCFrame = workspace.CurrentCamera.CFrame

	Camera.CameraType = Enum.CameraType.Scriptable
	local FrameTime = 0
	local Connection

	Connection = RunService.RenderStepped:Connect(function(DT)
		local NewDT = DT * 60
		FrameTime += NewDT
		local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
		if NeededFrame then
			Character.Humanoid.AutoRotate = false
			Camera.CFrame = Character.HumanoidRootPart.CFrame * NeededFrame.Value
		else
			Connection:Disconnect()
			Character.Humanoid.AutoRotate = true
			Camera.CameraType = Enum.CameraType.Custom
			Camera.CFrame = CurrentCameraCFrame	
		end
	end)
end


RemoteEvent.OnClientEvent:Connect(Cinematic)
	```
" Workspace.Lukaa_Playz.Cut:10: attempt to index nil with 'WaitForChild' "
1 Like

You’re Firing the Client “player” and no longer passing anything else.

I assume you want the Character of the Enemy to be sent to the client.
that’d be

cut:FireClient(player,EnemyVariableHere)

Let me know if I’m wrong in this assumption.

Note: If you use this code, that also means Player:WaitForChild("Character") is incorrect; and it was incorrect to begin with since Character is a property of Player instances and can’t be waited on using WaitForChild, but I digress. It’d now be local Character = Player as it was before.

1 Like

Honestly all of this was some vague guessing and stuff. At the moment it works Only for the player which uses the attack, and nobody else sees it however, i need the enemy to also see it. but of an oddball here

local RunService = game:GetService("RunService")

local RemoteEvent = game.ReplicatedStorage.Events.CUTSCENE
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

local Camera = workspace.Camera

local function Cinematic(Player,player2)
	
	local CinematicsFolder = game.Lighting.Actualscene_Camera -- Path to your folder! 

	local CurrentCameraCFrame = workspace.CurrentCamera.CFrame

	Camera.CameraType = Enum.CameraType.Scriptable
	local FrameTime = 0
	local Connection

	Connection = RunService.RenderStepped:Connect(function(DT)
		local NewDT = DT * 60
		FrameTime += NewDT
		local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
		if NeededFrame then
			Character.Humanoid.AutoRotate = false
			Camera.CFrame = Character.HumanoidRootPart.CFrame * NeededFrame.Value
		else
			Connection:Disconnect()
			Character.Humanoid.AutoRotate = true
			Camera.CameraType = Enum.CameraType.Custom
			Camera.CFrame = CurrentCameraCFrame	
		end
	end)
end


RemoteEvent.OnClientEvent:Connect(Cinematic)
	

enemy is the character of the hit player

local eneplaye = Players:GetPlayerFromCharacter(enemy)

cut:FireClient(player,eneplaye)
1 Like

Sorry, I went to eat breakfast; if you want the enemy to also see it do this:

-- Add another FireClient call (keep current call)
cut:FireClient(eneplaye) -- add any arguments missing
1 Like

Just that on its own or just run the thing again?

1 Like

You have to add that call to wherever your other call

cut:FireClient(player,eneplaye)

is. This is just adding code, don’t remove anything.

2 Likes

i did that and it still only plays for one person, however if i change it from player to ene player it plays for the hit person rather than the hitter idk whats happening ngl

If you would, send me the server script that manages firing the client to the enemy and the hitter.

I can attempt to fix it for you directly, since I’m getting lost atm.

1 Like

Good Luck lmao
Heres what fires the server script firstly:

local debounce = false
local event  = game.ReplicatedStorage.Events:WaitForChild("ValueChange")
local Tool = script.Parent


local name = "Treatment"
local function cooldown(cooldown)
	for i = 1,cooldown do
		cooldown = cooldown - 1
		Tool.Name = cooldown
		wait(1)
	end
	Tool.Name = name
end

Tool.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		if not debounce then
			debounce = true
			event:FireServer(name)
			cooldown(2)
			debounce = false
		end
	end)
end)


Heres the server script:

local replstor = game.ReplicatedStorage
local event  = replstor.Events:WaitForChild("ValueChange")
local track
local tweenService = game:GetService("TweenService")
local Ragdoll = require(game.ServerScriptService.Ragdoll)
local curve = require(game.ServerScriptService.BezierCurve)
local cut = game.ReplicatedStorage.Events.CUTSCENE
local Players = game:GetService("Players")

event.OnServerEvent:Connect(function(player,name)
	
	if name == "Treatment" then
		local attacking = game.ServerStorage.Values.Action:Clone()
		local IFrame = game.ServerStorage.Values.Invincible:Clone()
		local enemy
		local Character = player.Character
		local Root = Character:WaitForChild("HumanoidRootPart")
		local Humanoid = Character.Humanoid
		local cutscene = false
		if Humanoid:GetState() == Enum.HumanoidStateType.Freefall or Character.Status:FindFirstChild("Action") or  Character.Status:FindFirstChild("Stunned") then return end

		attacking.Parent = Character.Status
		IFrame.Parent = Character.Status
		game.Debris:AddItem(IFrame,0.8)
		game.Debris:AddItem(attacking,1.2)

		Humanoid.WalkSpeed = 0
		Humanoid.JumpPower = 0
		
		
		local hitter = Instance.new("Animation")
		hitter.AnimationId = "rbxassetid://11292234143"
		local hits = Character.Humanoid:LoadAnimation(hitter)
		hits:Play()
		Humanoid.AutoRotate = false
		spawn(function()
			wait(0.4)
			local bv = Instance.new("BodyVelocity",Character.HumanoidRootPart)
			bv.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 10 
			bv.MaxForce = Vector3.new(1e8,1e8,1e8)
			game.Debris:AddItem(bv,0.3)
		end)


		local function Hitbox()
			wait(0.2)
			local hb
			hb = Instance.new("Part")
			hb.Size = Vector3.new(1.5,5,1.5)
			hb.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2.25)
			hb.Anchored = false
			hb.CanCollide = false
			hb.Transparency = 0
			hb.Massless = true
			hb.Name = "hb"
			hb.Material = Enum.Material.ForceField
			hb.CanQuery = false
			local weld = Instance.new("Weld", hb)
			weld.Part0 = Character.HumanoidRootPart
			weld.Part1 = hb
			weld.C1 = CFrame.new(0,0,4) * CFrame.Angles(math.rad(10),0,math.rad(0))
			hb.Parent = workspace.Fx
			spawn(function()
				wait(0.15)
				weld:Destroy()
				hb.Anchored = true
			end)
			game.Debris:AddItem(hb,0.5)
			local debounce
			
			hb.Touched:Connect(function(Hit)
				if Hit:IsDescendantOf(Character) then return end
				if not Hit.Parent:FindFirstChild("Humanoid") then return end
				if not debounce then 
					Root.Anchored = true
					debounce = true
					cutscene = true
					hb:Destroy()
					enemy = Hit.Parent
					
					--vars
					local slashspin = game.ReplicatedStorage.Cinema.Slash:Clone()
					local ring = game.ReplicatedStorage.Cinema.ring:Clone()
					local spin = game.ReplicatedStorage.Cinema.Shock:Clone()

					local eneplaye = Players:GetPlayerFromCharacter(enemy)

					cut:FireClient(player,eneplaye)
					enemy.HumanoidRootPart.Anchored = true
					enemy.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
					enemy.HumanoidRootPart.CFrame = CFrame.lookAt(enemy.HumanoidRootPart.CFrame.Position, Vector3.new(Root.Position.X, Root.Position.Y, Root.Position.Z))
					local animation = Instance.new("Animation")
					animation.AnimationId = "rbxassetid://11292231293"
					local track = enemy.Humanoid:LoadAnimation(animation)
					track:Play()
					enemy.Head.Ringg:Play()
					enemy.Head.knuckle_crack:Play()
					enemy.HumanoidRootPart.Nose:Play()
					enemy.HumanoidRootPart.Hit:Play()

					wait(1)
					hits:Stop()
					local animation2 = Instance.new("Animation")
					animation2.AnimationId = "rbxassetid://11292553671"
					local track2 = Character.Humanoid:LoadAnimation(animation2)
					local animation = Instance.new("Animation")
					animation.AnimationId = "rbxassetid://11292554519"
					local track = enemy.Humanoid:LoadAnimation(animation)
					track:Play()
					track2:Play()
					track2:GetMarkerReachedSignal("slide"):Connect(function(paramString)
						Character.HumanoidRootPart.Slide:Play()
					
					end)
					track2:GetMarkerReachedSignal("spin"):Connect(function(paramString)
						Character.HumanoidRootPart.woosh:Play()
						spawn(function()
							slashspin.CFrame = Root.CFrame
							slashspin.Parent = workspace.Fx
							spin.CFrame = Root.CFrame
							spin.Parent = workspace.Fx
							ring.CFrame = Root.CFrame
							slashspin.Swing:Play()
							ring.Parent = workspace.Fx
							game.Debris:AddItem(spin,3)
							game.Debris:AddItem(slashspin,3)
							spawn(function()
								local TweenService = game:GetService("TweenService") --gets service for tween
								local tweenPart = slashspin --the part you want to tween (you can change this)

								local info = TweenInfo.new(
									0.2,           --seconds it takes to complete loop
									Enum.EasingStyle.Linear,     --easingstyle (how it moves)
									Enum.EasingDirection.InOut,    --easingdirection (which direction)
									0,                    --times repeated (negative number if u want infinite)
									false,                 --reverse (does it go back to its spot)
									0                      --delay time (stoptime before doing the tween)
								)

								local Goals = {             --YOU CAN CHANGE THESE AND DELETE THE THINGS YOU DON'T WANT TO TWEEN
									Transparency = 0.011, --transparency

									--add or delete properties, its all yours
								}

								local PartTween = TweenService:Create(tweenPart, info, Goals) --gets all the info and goals and creates tween
								PartTween:Play() --plays it
							end)
							spawn(function()
								wait(0.1)
								local TweenService = game:GetService("TweenService") --gets service for tween
								local tweenPart = slashspin --the part you want to tween (you can change this)

								local info = TweenInfo.new(
									1,           --seconds it takes to complete loop
									Enum.EasingStyle.Linear,     --easingstyle (how it moves)
									Enum.EasingDirection.InOut,    --easingdirection (which direction)
									0,                    --times repeated (negative number if u want infinite)
									false,                 --reverse (does it go back to its spot)
									0                      --delay time (stoptime before doing the tween)
								)

								local Goals = {             --YOU CAN CHANGE THESE AND DELETE THE THINGS YOU DON'T WANT TO TWEEN
									Transparency = 1, --transparency

									--add or delete properties, its all yours
								}

								local PartTween = TweenService:Create(tweenPart, info, Goals) --gets all the info and goals and creates tween
								PartTween:Play() --plays it
							end)
						end)
					end)

					track2:GetMarkerReachedSignal("break"):Connect(function(paramString)
						enemy.HumanoidRootPart.Bonebreak:Play()
						enemy.HumanoidRootPart.Hit:Play()

					end)
					track2:GetMarkerReachedSignal("lean"):Connect(function(paramString)
						enemy.HumanoidRootPart.Land:Play()
						enemy.HumanoidRootPart.Clothe:Play()
						enemy.HumanoidRootPart["Flame Light"]:Play()


					end)
					track2:GetMarkerReachedSignal("up"):Connect(function(paramString)
						local slash = game.ReplicatedStorage.Cinema.Updraft
						slash.CFrame = Root.CFrame * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(90))
						slash.Parent = workspace.Fx
						
						spawn(function()
							local TweenService = game:GetService("TweenService") --gets service for tween
							local tweenPart = slash --the part you want to tween (you can change this)

							local info = TweenInfo.new(
								0.2,           --seconds it takes to complete loop
								Enum.EasingStyle.Linear,     --easingstyle (how it moves)
								Enum.EasingDirection.InOut,    --easingdirection (which direction)
								0,                    --times repeated (negative number if u want infinite)
								false,                 --reverse (does it go back to its spot)
								0                      --delay time (stoptime before doing the tween)
							)

							local Goals = {             --YOU CAN CHANGE THESE AND DELETE THE THINGS YOU DON'T WANT TO TWEEN
								Transparency = 0.1, --transparency

								--add or delete properties, its all yours
							}

							local PartTween = TweenService:Create(tweenPart, info, Goals) --gets all the info and goals and creates tween
							PartTween:Play() --plays it
						end)
						wait(0.25)
						spawn(function()
							local TweenService = game:GetService("TweenService") --gets service for tween
							local tweenPart = slash --the part you want to tween (you can change this)

							local info = TweenInfo.new(
								0.5,           --seconds it takes to complete loop
								Enum.EasingStyle.Linear,     --easingstyle (how it moves)
								Enum.EasingDirection.InOut,    --easingdirection (which direction)
								0,                    --times repeated (negative number if u want infinite)
								false,                 --reverse (does it go back to its spot)
								0                      --delay time (stoptime before doing the tween)
							)

							local Goals = {             --YOU CAN CHANGE THESE AND DELETE THE THINGS YOU DON'T WANT TO TWEEN
								Transparency = 1, --transparency

								--add or delete properties, its all yours
							}

							local PartTween = TweenService:Create(tweenPart, info, Goals) --gets all the info and goals and creates tween
							PartTween:Play() --plays it
						end)
					
						enemy.HumanoidRootPart.HitHeavy:Play()
						enemy.HumanoidRootPart.Reverse:Play()
						enemy.HumanoidRootPart.Ring:Play()
						Character.HumanoidRootPart.Effect:Play()
						Character.HumanoidRootPart.up2:Play()
						wait(2)
						enemy.HumanoidRootPart.Anchored = false
						local bv = Instance.new("BodyVelocity",enemy.HumanoidRootPart)
						bv.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100 + Vector3.new(0,70,0)
						bv.MaxForce = Vector3.new(1e8,1e8,1e8)
						game.Debris:AddItem(bv,0.5)
						wait(0.2)
						Humanoid.AutoRotate = true
						Root.Anchored = false
					end)
				

				

					wait(1)
					cutscene = false
					debounce = false

				end


			end)
			wait(1)
			if cutscene == false then
				Humanoid.AutoRotate = true
				Root.Anchored = false
			end
			Humanoid.WalkSpeed = 16 * Character.Values.WalkSpeed.Value
			Humanoid.JumpPower = 50
		end
		Hitbox()
	end




end)

And heres the cam script

local RunService = game:GetService("RunService")

local RemoteEvent = game.ReplicatedStorage.Events.CUTSCENE
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

local Camera = workspace.Camera

local function Cinematic(Player,eneplayer)
	
	
	local CinematicsFolder = game.Lighting.Actualscene_Camera -- Path to your folder! 

	local CurrentCameraCFrame = workspace.CurrentCamera.CFrame

	Camera.CameraType = Enum.CameraType.Scriptable
	local FrameTime = 0
	local Connection

	Connection = RunService.RenderStepped:Connect(function(DT)
		local NewDT = DT * 60
		FrameTime += NewDT
		local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
		if NeededFrame then
			Character.Humanoid.AutoRotate = false
			Camera.CFrame = Character.HumanoidRootPart.CFrame * NeededFrame.Value
		else
			Connection:Disconnect()
			Character.Humanoid.AutoRotate = true
			Camera.CameraType = Enum.CameraType.Custom
			Camera.CFrame = CurrentCameraCFrame	
		end
	end)
end


RemoteEvent.OnClientEvent:Connect(Cinematic)