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

Why won't the background appear after animation?

Here's my script

local char = script.Parent --the npc
local hum = char:WaitForChild("Humanoid") --the npc's humanoid
local animation = hum:LoadAnimation(script.Animation) --finds the animation inside the script and loads it in the npc's humanoid
  
if char ~= nil then --this just checks if the npc exists
	animation:Play() --plays the animation
	wait(1)
 	game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0
end

Why won't the background appear after the animation?

2 comments

0

That is because you're using the StarterGui and not the PlayerGui. The StarterGui is what the PlayerGui clones out of, so the player's GUI is in the PlayerGui, not the StarterGui. If this is for an NPC i am assuming this is in a server script, meaning you'll need remotes.

0

Can you expand upon this, I know very little about scripting and that stuff...

2 answers

✓ Accepted answer

You are accessing startergui, you must access playergui that is inside the local player, you will need a local script or use remote events

With a local Script :


    game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0



1 comment

0

Ok, I put that instead and it still is not working. How do I use remote events or whatever that is?

You're changing the gui from the starterGui. The way the StarterGui works is that it clones anything in there and inserts it into the player's PlayerGui. I think you're trying to change the gui for all players. To do that I would do something like

local people = game.Players:GetChildren() -- Get all players playing
for a, b in pairs(people) do
	b.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0
end -- Change each of their frame's backgroundtransparency to 0

If that's not what you're trying to do, just comment and I will try to fix my answer accordingly

5 comments

0

Ok, so what I'm trying to do is, first of all they will be one player servers, and I just want the screen to turn black after the intro animation and have the play button go there too. What the play button does is it teleports you to another one player game.

0

use game.Players:GetPlayers() not :GetChildren()

0

^

0

This does not seem to work

0

I just want the screen to turn black when the animation finishes

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