You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I would like to be able to start a local script from another local script, then change the player camera to the one in the script.
What is the issue? Include screenshots / videos if possible!
The print() doesn’t return the text, and that part of the script doesn’t start.
Local Script
--code before firing the event
local Winter = game.Workspace.Winter.Camera
Winter:FireServer()
Local Script
local event = script.Parent
local function Camera()
print ("fired")
local Event = script.Parent
local MainCamera = workspace.CurrentCamera
local Folder = game.Workspace.Winter
local FirstCamera = Folder.WinterCam
local FinalCamera = Folder.FinalWinterCam
MainCamera.CameraType = Enum.CameraType.Scriptable
MainCamera:Interpolate(FirstCamera.CFrame, FinalCamera.CFrame, 5)
end
event.OnClientEvent:Connect(Camera)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried searching around, found nothing
Well you could move local scripts in the player’s character, only if they are in workspace. I don’t get why you don’t use BindableEvents for Client-Client communication.
You should put your event in Replicated storage. And it should look something like this:
Make sure to use a bindable event.
-- LocalScript 1
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local bindableEvent = ReplicatedStorage:WaitForChild("BindableEvent")
bindableEvent:Fire()
-- LocalScript 2
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local bindableEvent = ReplicatedStorage:WaitForChild("BindableEvent")
local function OnEvent()
--Here you can place your function
end
bindableEvent.Event:Connect(OnEvent)
It doesn’t start anyway.
I changed the remote event to bindable event, moved it with the 2’ script in the replicated storage and fixed the script.
Local script 1
--code
local Winter = game.ReplicatedStorage.Script.WinterCam
Winter:Fire()
Local script 2
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = script.Parent
local function Camera()
print ("fired")
local Event = script.Parent
local MainCamera = workspace.CurrentCamera
local Folder = game.Workspace.Winter
local FirstCamera = Folder.WinterCam
local FinalCamera = Folder.FinalWinterCam
MainCamera.CameraType = Enum.CameraType.Scriptable
MainCamera:Interpolate(FirstCamera.CFrame, FinalCamera.CFrame, 5)
end
event.Event:Connect(Camera)
is there a trigger to these events as one script may load before the other meaning the event has been fired but the other script has not loaded quick enough to register it
what is your trigger then as that might be the problem
edit: Btw i suggest using :WaitForChild in local scripts as it is a good habit to make sure you limit how many errors from loading issues
it’s a consequence of story scripts, as one start another when it finishes. There are no problems with starting the script, the only problem is this event
The file is full of other scripts and it can be messy to find the one i’m having problems with, as the 1 local script isn’t that empity. Would you like me to send you a clear file of it?