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

Intro Gui is playing in Studio, but it doesn't play in-game. How do I fix it?

Asked by 6 years ago

Basically, I made an Intro Gui today, it works in studio, but as soon as we get in-game, I just have a white frame and the Intro doesn't play as intended. Here's the code(it's in a local script)

local image = script.Parent
local fmaLogo = script.Parent.Parent["FMA Logo"]
local textLabel = script.Parent.TextLabel
local frame = script.Parent.Parent
local music = script.IntroMusic:Clone()
music.Parent = workspace
music:Play()

game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
    music:Remove()
end)

wait(2)

for i=1, 10 do
    image.ImageTransparency = image.ImageTransparency - 0.1
    wait(0.1)
end

wait(1)
textLabel:TweenPosition(UDim2.new(0.103, 0,1.024, 0), "In", "Linear", 1)
wait(0.5)
textLabel.TextTransparency = 0

wait(2)

textLabel.TextTransparency = 1

for i=1, 10 do
    image.ImageTransparency = image.ImageTransparency + 0.1
    wait(0.1)
end

wait(1)

for i=1, 10 do
    fmaLogo.ImageTransparency = fmaLogo.ImageTransparency - 0.1
    wait(0.1)
end


fmaLogo:TweenPosition(UDim2.new(0.35, 0, 0, 0), "In", "Linear", 1)

for i=1, 10 do
    frame.BackgroundTransparency = frame.BackgroundTransparency + 0.1
    wait(0.1)
end
0
it's Destroy not Remove. It's Connect not connect User#19524 175 — 6y
0
Didn't fix my problem, but thanks for the help LuaPrescott 2 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

I think your problem may be the fact that you're calling localplayer's character before it loads. I assume that your script is inside of a TextLabel, inside of a Gui, that's inside of the StarterGui right? It would be much simpler to just script out the whole gui, then parent it to the playerGui. Also, I noticed that you're cloning Music presumably inside the LS itself, and then parenting it to the workspace? It would also be much more efficient to parent the sound to the player's playergui so only indiviual players will hear the opening theme. Or if multiple players join, the workspace won't be bombarded. Hope this helps.

local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:wait()
local character = player.Character or player.CharacterAdded:wait()
local playergui = player:WaitForChild('PlayerGui')
0
Thanks, savior LuaPrescott 2 — 6y
0
No problem! :) KardashevScale 110 — 6y
Ad

Answer this question