Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This script is playing before the player is in the game can someone help me fix it?

Asked by
Damo999 182
9 years ago

my intro is playing in the loading screen and I can't seem to figure out how to wait until the player is in the game so that the player can actually see the intro

01local player = script.Parent.Parent
02 
03rf = game.ReplicatedFirst
04rs = game.ReplicatedStorage
05vc = game.Workspace.Views
06 
07repeat wait() until player.Character
08 
09game.Workspace.CurrentCamera.CameraSubject = vc.V1
10game.Workspace.CurrentCamera.CameraType = "Scriptable"
11game.workspace.Camera.CoordinateFrame = vc.V1.CFrame
12 
13player.CameraMaxZoomDistance=25
14player.Character.Humanoid.Name="Humanoid_" --anti reset from menu
15 
View all 49 lines...
0
repeat wait() until player is ingame HungryJaffer 1246 — 9y

1 answer

Log in to vote
0
Answered by
Marios2 360 Moderation Voter
9 years ago

All you need is a check that the player exists. As you're using a server script, we wait for script.Parent.Parent to be a Player.

01repeat wait() until script.Parent.Parent.ClassName == "Player"
02local player = script.Parent.Parent --The rest of your script is identical to the original hereby
03 
04rf = game.ReplicatedFirst
05rs = game.ReplicatedStorage
06vc = game.Workspace.Views
07 
08repeat wait() until player.Character
09 
10game.Workspace.CurrentCamera.CameraSubject = vc.V1
11game.Workspace.CurrentCamera.CameraType = "Scriptable"
12game.workspace.Camera.CoordinateFrame = vc.V1.CFrame
13 
14player.CameraMaxZoomDistance=25
15player.Character.Humanoid.Name="Humanoid_" --anti reset from menu
View all 50 lines...
Ad

Answer this question