I’m trying to make a script that spawns a player in a box, makes the camera in a certain position, tweens it into another position, then makes a button and title fade in.
The problem is literally none of the script is working anymore, I’ll occasionally get infinite yield possible warnings on the menu cameras and when I check the workspace, usually only 1 of the cameras load and it’s not even transparent.
I’ve tried altering the script and at one point a part of it worked and then I messed it up and forgot what I did. I’ve looked on the devforum and found nothing that can specifically match my problem.
local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local CurrentCamera = game.Workspace.CurrentCamera
local Cameras = game.Workspace:WaitForChild("MenuCams")
local Cam1 = Cameras:WaitForChild("MenuCam1")
local Cam2 = Cameras:WaitForChild("MenuCam2")
local Play = Player.PlayerGui:WaitForChild("PlayerGui").BaseFrame.MenuFrame.Play
local Title = Player.PlayerGui:WaitForChild("PlayerGui").BaseFrame.MenuFrame.Title
local Sub = Player.PlayerGui:WaitForChild("PlayerGui").BaseFrame.MenuFrame.Subtitle
--Player.RespawnLocation = game.Workspace:WaitForChild("Spawn").StartingSpawn
game.Lighting.Blur.Size = 10.5
game.StarterPlayer.CharacterWalkSpeed = 0
game.StarterPlayer.CharacterUseJumpPower = false
Cam1.Transparency = 1
Cam2.Transparency = 1
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = Cam1.CFrame
Fadeinfo = TweenInfo.new(2, Enum.EasingStyle.Linear)
SubFadeinfo = TweenInfo.new(3, Enum.EasingStyle.Linear)
AnimInfo = TweenInfo.new(5, Enum.EasingStyle.Cubic, Enum.EasingDirection.In)
local Anim = TweenService:Create(Cam1.CFrame, AnimInfo, {CFrame = CFrame.new(Cam2.CFrame)})
local PlayFadeIn = TweenService:Create(Play, Fadeinfo, {TextTransparency = 0})
local SubFadeIn = TweenService:Create(Sub, Fadeinfo, {TextTransparency = 0})
local TitleFadeIn = TweenService:Create(Title, Fadeinfo, {TextTransparency = 0})
local TitleStrokeFadeIn = TweenService:Create(Title.UIStroke, SubFadeinfo, {Transparency = 0.5})
local SubStrokeFadeIn = TweenService:Create(Sub.UIStroke, SubFadeinfo, {Transparency = 0.5})
task.wait(2.5)
Anim:Play()
task.wait(5.5)
TitleFadeIn:Play()
SubFadeIn:Play()
TitleStrokeFadeIn:Play()
SubStrokeFadeIn:Play()
task.wait(1)
PlayFadeIn:Play()
(local script in starterplayerscripts)
Apologies for any deprecated, unorganized, sloppy, or in general horrible scripting
So, I had this problem once.
The reason why you’re getting a infinite yield on the Camera Parts is ROBLOX isn’t loading it on the client due to the player being to far away from the part.
I recommend checking out this post and the solution.
I tried this with the old script and it kinda worked but I got an error about the script expecting vector3 and not cframe in the anim tween so I tried it with this script and the screen only blurs but nothing else happened. I also tried changing the model’s modelstreamingmode property to persistent (like @WizulousThe2nd said) but it didn’t make much of an impact, I just don’t get the infinite yield possible warning anymore. Heres my new script:
local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local CurrentCamera = game.Workspace.CurrentCamera
local Cameras = game.Workspace:WaitForChild("MenuCams")
local Cam1 = Cameras:WaitForChild("MenuCam1")
local Cam2 = Cameras:WaitForChild("MenuCam2")
local Play = Player.PlayerGui:WaitForChild("PlayerGui").BaseFrame.MenuFrame.Play
local Title = Player.PlayerGui:WaitForChild("PlayerGui").BaseFrame.MenuFrame.Title
local Sub = Player.PlayerGui:WaitForChild("PlayerGui").BaseFrame.MenuFrame.Subtitle
game.Lighting.Blur.Size = 10.5
game.StarterPlayer.CharacterWalkSpeed = 0
game.StarterPlayer.CharacterUseJumpPower = false
Cam1.Transparency = 1
Cam2.Transparency = 1
CurrentCamera:GetPropertyChangedSignal("CameraType"):Wait()
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = CFrame.new(Vector3.new(Cam1.CFrame))
Fadeinfo = TweenInfo.new(2, Enum.EasingStyle.Linear)
SubFadeinfo = TweenInfo.new(3, Enum.EasingStyle.Linear)
AnimInfo = TweenInfo.new(5, Enum.EasingStyle.Cubic, Enum.EasingDirection.In)
local Anim = TweenService:Create(Cam1.CFrame, AnimInfo, {CFrame = CFrame.new(Vector3.new(Cam2.CFrame))})
local PlayFadeIn = TweenService:Create(Play, Fadeinfo, {TextTransparency = 0})
local SubFadeIn = TweenService:Create(Sub, Fadeinfo, {TextTransparency = 0})
local TitleFadeIn = TweenService:Create(Title, Fadeinfo, {TextTransparency = 0})
local TitleStrokeFadeIn = TweenService:Create(Title.UIStroke, SubFadeinfo, {Transparency = 0.5})
local SubStrokeFadeIn = TweenService:Create(Sub.UIStroke, SubFadeinfo, {Transparency = 0.5})
task.wait(2.5)
Anim:Play()
task.wait(5.5)
TitleFadeIn:Play()
SubFadeIn:Play()
TitleStrokeFadeIn:Play()
SubStrokeFadeIn:Play()
task.wait(1)
PlayFadeIn:Play()
In the script, the player is not supposed to be able to walk or jump. Additionally, the player’s CFrame is supposed to be on Cam1 and then it should tween to Cam2. However, the only part of this script that works is the blur.