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

Script not executing after function was added?

Asked by 8 years ago
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

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago
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)
Ad
Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

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...
1
...Intro is the ScreenGui.... MEANDUDE87 60 — 8y
1
And ssye is a variable.. MEANDUDE87 60 — 8y
2
incorrect DaCrazyDev 444 — 8y
Log in to vote
1
Answered by 8 years ago

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

Answer this question