Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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


1 comment

0

repeat wait() until player is ingame

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.