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


local player = script.Parent.Parent rf = game.ReplicatedFirst rs = game.ReplicatedStorage vc = game.Workspace.Views repeat wait() until player.Character game.Workspace.CurrentCamera.CameraSubject = vc.V1 game.Workspace.CurrentCamera.CameraType = "Scriptable" game.workspace.Camera.CoordinateFrame = vc.V1.CFrame player.CameraMaxZoomDistance=25 player.Character.Humanoid.Name="Humanoid_" --anti reset from menu local a = rs.Theme:Clone() a.Parent=game.Workspace.CurrentCamera a:Play() local a = rf.EnterGui:Clone() a.Parent = player.PlayerGui wait(4) for n = 1,0,-0.1 do wait(0.1) a.Background_Frame.TextLabel.TextTransparency=n end wait(4) for n = 0,1,0.1 do wait(0.1) a.Background_Frame.TextLabel.TextTransparency=n end wait(4) for n = 1,0,-0.1 do wait(0.1) a.Logo_ImageLabel.ImageTransparency=n end wait(4) for n = 0,1,0.1 do wait(0.1) a.Background_Frame.BackgroundTransparency=n end
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.

repeat wait() until script.Parent.Parent.ClassName == "Player"
local player = script.Parent.Parent --The rest of your script is identical to the original hereby

rf = game.ReplicatedFirst
rs = game.ReplicatedStorage
vc = game.Workspace.Views

repeat wait() until player.Character

game.Workspace.CurrentCamera.CameraSubject = vc.V1
game.Workspace.CurrentCamera.CameraType = "Scriptable"
game.workspace.Camera.CoordinateFrame = vc.V1.CFrame

player.CameraMaxZoomDistance=25
player.Character.Humanoid.Name="Humanoid_" --anti reset from menu


local a = rs.Theme:Clone()
a.Parent=game.Workspace.CurrentCamera
a:Play()

local a = rf.EnterGui:Clone()
a.Parent = player.PlayerGui

wait(4)

for n = 1,0,-0.1 do
wait(0.1)
a.Background_Frame.TextLabel.TextTransparency=n
end

wait(4)

for n = 0,1,0.1 do
wait(0.1)
a.Background_Frame.TextLabel.TextTransparency=n
end

wait(4)

for n = 1,0,-0.1 do
wait(0.1)
a.Logo_ImageLabel.ImageTransparency=n
end

wait(4)
for n = 0,1,0.1 do
wait(0.1)
a.Background_Frame.BackgroundTransparency=n
end
Ad

Answer this question