Why is a remote event not working pausing the script

Hi all

  1. What do you want to achieve? I wanted a remote event to be fired in the middle of a tween script.

  2. **What is the issue?**when the script come to the line in which the event is being fired the second tween wont play and the other script wont be able to detect the event being fired

The script which is fireing the event


local Car = game.Workspace.Car
local Destination1 = game.Workspace.Car1
local Destination2 = game.Workspace.Car2

local TweenService = game:GetService("TweenService")
local CarTweenInfo = TweenInfo.new(5, 
									Enum.EasingStyle.Linear,
									Enum.EasingDirection.Out,
									0,
									false,
									0)

local CarTween = TweenService:Create(Car, CarTweenInfo, {CFrame = Destination1.CFrame})
local CarTween2 = TweenService:Create(Car, CarTweenInfo, {CFrame = Destination2.CFrame})

game.ReplicatedStorage.CarTrigger.OnServerEvent:Connect(function()
	CarTween:Play()
	game.Workspace["Car Engine"]:Play()
	game.ReplicatedStorage.CutsceneTrigere:FireClient()
	CarTween2:Play()
	wait(4.8)
	game.Workspace["Car Engine"].Looped = false
	game.Workspace["Car Stop 1.1"]:Play()
	script.Parent.Tween.Disabled = true
end)

	


The script which is detecting the event being fired:

wait(9)
local TweenService  = game:GetService("TweenService")
local camera  = game.Workspace.CurrentCamera
local Desto = game.Workspace.Desto

local tweenInfo = TweenInfo.new(12, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)


function tween(part1,part2)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame

	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()
	
	wait(13)
	game.Workspace.Angle4.Transparency = 0
	wait(0.4)
	game.Workspace["car door"]:Play()
	wait(6)
	for _, player in pairs(game.Players:children())do
		local char = player.Character
		char.HumanoidRootPart.CFrame = Desto.CFrame
	end
	camera.CameraType = Enum.CameraType.Custom
end

game.ReplicatedStorage.CutsceneTrigere.OnClientEvent:Connect(function()
	tween(game.Workspace.Angle2, game.Workspace.Angle3)
	wait(12)
end)


Note:The Script which is fireing the event is a server script and the detecting script is a local script.
Thank You

Remember, it’s not wait() it’s task.wait() now but you aren’t firing the event at all. You’re listening for the event;

game.ReplicatedStorage.CarTrigger.OnServerEvent:Connect(function()

This is listening for the event being fired.

To fire an event you can do:

game.ReplicatedStorage.CarTrigger:FireServer()

So what I can make out of your code is that you’re trying to send a remote event to a client without specifying to which client. :FireClient() cannot be empty, it should be something like :FireClient(player) so the server knows who to send the event to.

Hope this helps! :slight_smile:

Hi
I tried filling the argument with:
local player = game.Players.LocalPlayer

but then this error popped up:
FireClient: player argument must be a Player object

I dont have a clue how to fix his.Doyou?

you cannot use localplayer in a server script, and :children() is :GetChildren()

looks like you’re collecting info from a fireserver() event

, so this should be game.ReplicatedStorage.CarTrigger.OnServerEvent:Connect(function(player)
so you can identify the player game.ReplicatedStorage.CutsceneTrigere:FireClient(player)