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

HELP!! How can I make this script wait until the character load to start the intro?

Asked by 7 years ago

I can't find a reason why my script won't work. I want to wait until player spawns to start the intro, but it's not working! Here's my script and please tell me what I did wrong. P.S., this is a local script.

local parent = script.Parent
local back = script.Parent.Behind
local parent = script.Parent
local welcome1 = script.Parent.Text1
local char = game.Players.LocalPlayer:WaitForChild("Character")
----Music----
ID = '170758880'
Looped = true -- Set to false if you want non-looped music.

Music=Instance.new("Sound" ,parent)
Music.Name = "Music"
if Looped == true then
Music.Looped = true
end
Music.SoundId = "http://roblox.com/asset/?id=170758880"
Music.Volume = 1
Music:Play()
----For Statments----
wait(0.6)
if char.Loaded == true then
    for i = 1, 0, 0.02 do
        welcome1.TextTransparency = i
        wait()
        wait(0.9)
        for l = 0, 1, 0.02 do
            welcome1.TextTransparency = l
        end
    end
end

1 answer

Log in to vote
0
Answered by 7 years ago

Character isn't a child of player, it's a property. This is how you access it:

--// Local Script
local plr = game.Players.LocalPlayer
local char = plr.Character

If you want to MAKE SURE the char variable has the character, use this:

--// Local Script
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
0
it still didnt work, but after i changed the plr properties and char properties, the music started playing but now when i press f9, it says Loaded is not a valid member of Model, and i dont even have a part in my workspace named Model. Why does this happen? supercoolboy8804 114 — 7y
Ad

Answer this question