So Mad studio has an intro where something falls and destroys the M. I made my own version of this and I wanted to script it so that for every person that joins the game would see the intro (therefore changing the cam. ) and before it changes the camera to a different location (menu location) . UPDATED: ITS A REGULAR SCRIPT INSIDE THE WORKSPACE
game.ReplicatedFirst:RemoveDefaultLoadingScreen() local FB = game.ReplicatedStorage.firstblack local FG = game.ReplicatedStorage.firstgold local SB = game.ReplicatedStorage.secondblack local SG = game.ReplicatedStorage.secondgold local TB = game.ReplicatedStorage.thirdblack local TG = game.ReplicatedStorage.thirdgold local Sound = game.ReplicatedStorage.Sound local Sound2 = game.ReplicatedStorage.Sound2 local intro = game.ReplicatedStorage.introbuilding local cam = game.Workspace.CurrentCamera cam.CameraType = "Scriptable" game.Players.PlayerAdded:connect(function(player) Sound:Clone() intro:Clone() Sound2:Clone() FB:Clone() FG:Clone() SB:Clone() SG:Clone() TG:Clone() TB:Clone() print("Testing Intro with Player:" .. player.Name) wait(2) intro.Parent = cam FB.Parent = cam FG.Parent = cam SB.Parent = cam SG.Parent = cam TG.Parent = cam TB.Parent = cam cam.CoordinateFrame = CFrame.new(-79.86, 15.574, -68.35)*CFrame.Angles(0,109.95,0) ----Intro Cam LOCATION wait(2) -- The sounds cannot be in workspace becuase everyone would hear it .... -- so do I clone it to the Local player? Sound:Play() FB.script.Disabled = false -- to make the animated bricks to start working FG.script.Disabled = false SB.script.Disabled = false SG.script.Disabled = false TG.script.Disabled = false TB.script.Disabled = false if SG.Transparency ==0 then repeat wait(.10) Sound.Volume = Sound.Volume-.15 until Sound.Volume == 0 --- there isnt an end so Idk if this will break the script cause Sound2 cant play yet... ---Possible error? cam.CoordinateFrame = CFrame.new(-164, 13.46, -58.15)*CFrame.Angles(0,109.95,0)--NEW CAM LOCATION Sound2:Play() Sound2.Looped = true -- the end. end end)
I see major issues. You need to consider replication, and context
If this is a LocalScript, then you're in trouble because all of
local FB = game.ReplicatedFirst.firstblack:Clone() local FG = game.ReplicatedFirst.firstgold:Clone() local SB = game.ReplicatedFirst.secondblack:Clone() local SG = game.ReplicatedFirst.secondgold:Clone() local TB = game.ReplicatedFirst.thirdblack:Clone() local TG = game.ReplicatedFirst:Clone() local Sound = game.ReplicatedFirst.Sound:Clone() local Sound2 = game.ReplicatedFirst.Sound2:Clone() local intro = game.ReplicatedFirst.introbuilding:Clone()
might not have loaded yet. You're also about to reach the problem that Players.PlayerAdded
can't be used properly in a LocalScript.
If it's a server script, good luck doing any of this
local cam = game.Workspace.CurrentCamera cam.CameraType = "Scriptable" game.ReplicatedFirst:RemoveDefaultLoadingScreen()
because all of that stuff is LocalScript only.