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

Script not executing after function was added?

ssye = game.Players.LocalPlayer.PlayerGui

function OnPlayerEntered()
	
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0
wait(6)
ssye.Intro.Load:Destroy()
ssye.Intro.Reminder:Destroy()
wait(3)
ssye.Intro.Background.BackgroundTransparency = .1
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .2
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .3
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .4
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .5
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .6
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .7
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .8
wait(.1)
ssye.Intro.Background.BackgroundTransparency = .9
wait(.1)
ssye.Intro.Background.BackgroundTransparency = 1 

game.ServerStorage.DBZPicture:Clone().Parent = game.Players.LocalPlayer.PlayerGui.Intro
game.ServerStorage.DS:Play()

wait(5)
ssye.Intro.DBZPicture:Destroy()

end
game.Players.PlayerAdded:connect(OnPlayerEntered)

No output It's supposed to make an intro load only once for everyone. This is a Local Script. It worked until I added the function

3 answers

✓ Accepted answer
local Player = game.Players.LocalPlayer
local ssye =  Player.PlayerGui

Player.CharacterAdded:connect(function(character) --Instead of this, I'd recommend having a BoolValue tell us once ready. Your choice
	character.Humanoid.WalkSpeed = 0
	character.Humanoid.JumpPower = 0
	wait(6)
	ssye.Intro.Load:Destroy()
	ssye.Intro.Reminder:Destroy()
	wait(3)
	local back = ssye.Intro.Background
	for  i=1, 10  do
		back.BackgroundTransparency = back.BackgroundTransparency +  .1
		wait(.1)
	end
	game.ServerStorage.DBZPicture:Clone().Parent =Player.PlayerGui.Intro
	game.ServerStorage.DS:Play()
	wait(5)
	ssye.Intro.DBZPicture:Destroy()
	wait()
	script.Disabled = true -- This will disable the script. In short, it will only run once. Keep this at the end of the code

end)

Not here to spoonfeed you, but all you did was placing ssye in the PlayerGui?? I think you need a ScreenGui and then you can do whatever you want.

Player = game.Players.LocalPlayer
PlayerGui = Player.PlayerGui.ScreenGui...

3 comments

1

...Intro is the ScreenGui....

1

And ssye is a variable..

2

incorrect

This is in a LocalScript, this will ONLY work in a Client Script in workspace, so do not use localplayer,

instead do this

function OnPlayerEntered(player)
ssye = player.PlayerGui

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