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

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

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

2 comments

0

it's Destroy not Remove. It's Connect not connect

0

Didn't fix my problem, but thanks for the help

1 answer

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')

2 comments

0

Thanks, savior

0

No problem! :)

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