What solutions have you tried so far? I did, but I can’t seem to find the solution.
-- The server script server side (script)
local player = game:GetService("Players")
local event = game.ReplicatedStorage.Cutscene1
local order = 0
player.PlayerAdded:Connect(function(plr)
print(plr," joined!")
local Textlabel = plr.PlayerGui:WaitForChild("ScreenGui").Frame.TextLabel
Textlabel.Text = "3"
order = "1"
event:FireClient(plr,order)
print("fired")
wait(3)
Textlabel.Text = "2"
wait(3)
Textlabel.Text = "1"
wait(3)
end)
-- The cutscene side (local script)
local event = game.ReplicatedStorage.Cutscene1
local tweenservice = game:GetService("TweenService")
local cams = workspace.cams
local function Cutscene(order)
print(order)
print("receive")
workspace.Camera.CameraType = Enum.CameraType.Scriptable
TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
if order == 1 then
print("1")
local tween = tweenservice:Create(cams.c1,TweenInfo,cams.c2)
tween:Play()
workspace.Camera.CameraType = Enum.CameraType.Custom
else
print("error")
end
end
event.OnClientEvent:Connect(Cutscene)
--changed script
local event = game.ReplicatedStorage.Cutscene1
local tweenservice = game:GetService("TweenService")
local cams = workspace.cams
local function cutscene(order)
print(order)
workspace.Camera.CameraType = Enum.CameraType.Scriptable
TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
if order == 1 then
print("order1")
local tween = tweenservice:Create(cams.c1,TweenInfo,cams.c2)
tween:Play()
workspace.Camera.CameraType = Enum.CameraType.Custom
else
print("error")
end
end
event.OnClientEvent:Connect(cutscene)
Try this script. I made the code wait a bit before trying to access anything.
--changed script
game:GetService("Players").LocalPlayer.CharacterAppearanceLoaded:Wait()
local event = game.ReplicatedStorage.Cutscene1
local tweenservice = game:GetService("TweenService")
local cams = workspace.cams
local function cutscene(order)
order = tonumber(order)
workspace.Camera.CameraType = Enum.CameraType.Scriptable
TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
if order == 1 then
print("order1")
local tween = tweenservice:Create(cams.c1,TweenInfo,cams.c2)
tween:Play()
workspace.Camera.CameraType = Enum.CameraType.Custom
else
print("error")
end
end
event.OnClientEvent:Connect(cutscene)
2- After the camera line you only declared a TweenInfo, the code doesn’t know what to do with that info. I suggest looking at examples on tween service documentation to understand it better. You need to provide an object, target and an info, and you can play the tween after that
3- Use WaitForChild in the client
game.ReplicatedStorage:WaitForChild
workspace:WaitForChild
I changed the script a bit, it printed out “Unable to cast to Dictionary”
--changed script
local event = game.ReplicatedStorage:WaitForChild("Cutscene1")
local tweenservice = game:GetService("TweenService")
local cams = workspace:WaitForChild("cams")
-- cams
local cam1 = cams:WaitForChild("c1")
local cam2 = cams:WaitForChild("c2")
local function cutscene(order)
workspace.Camera.CameraType = Enum.CameraType.Scriptable
TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
if order == 1 then
print("order1")
local tween = tweenservice:Create(cam1,TweenInfo,Vector3.new(-5.955, 5.15, 20.29)) -- Unable to cast to Dictionary
tween:Play()
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
else
print("error")
end
end
event.OnClientEvent:Connect(cutscene)