I have a local script that explains what i want the event to do. this is the script:
local event = game.ReplicatedStorage.DoCutsceneEvent local TweenService = game:GetService("TweenService") local Camera = game.Workspace.CurrentCamera local function MoveCamera(StartPart, EndPart, Duration, EasingStyle, EasingDirection) Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = StartPart.CFrame local Cutscene = TweenService:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame}) Cutscene:Play() wait(Duration) end local function Cutscene() MoveCamera(game.Workspace.Cutscene1A, game.Workspace.Cutscene1B, 3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out) wait(1) game.Workspace.Truck.Truckdoor.Transparency = 1 game.Workspace.Truck.Truckdoor.Graffiti.Transparency = 1 game.Workspace.Truck.Truckdooropen.Transparency = 0 wait(1) MoveCamera(game.Workspace.Cutscene1B, game.Workspace.Cutscene1A, 3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out) wait(.5) Camera.CameraType = Enum.CameraType.Custom Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") wait(0.5) end event.OnClientEvent:Connect(function() Cutscene() end)
that was in the local script. i want to fire the event from a regular script and this is what i used:
local Cutscene = game.ReplicatedStorage.DoCutsceneEvent Cutscene:FireClient()
I've tried many things, but nothing worked. I need help, any thoughts would help.
:FireClient()
requires a parameter, namely the player Instance you want to fire to. When you're firing the server from the local script and the server picks it up, it receives an argument that is the player object which you can use.
event.OnServerEvent:Connect(function(player) -- your code event:FireClient(player) end)