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

One time Intro GUI doesn't work. after "game.Players.PlayerAdded:connect(functio..." was added, why?

Asked by
ziploz 7
8 years ago
game.Players.PlayerAdded:connect(function(player)

local black = script.Parent.Parent
local title = script.Parent
local joingame = script.Parent.Parent.TextButton

    for i = 0,1,0.1 do
    black.BackgroundTransparency = i
    wait(0.1)

    if black.BackgroundTransparency == 1 then
    script.Parent:TweenPosition (UDim2.new(0.5, -100, 0.1, -25), "Out", "Quad", 1, true)
    joingame.Visible = true   
    end
end

function onClicked()
    for i = 1,0,-0.1 do
        black.BackgroundTransparency = i
        wait (0.1)
    end
    wait(2)
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.Classic
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
title.Visible = false
joingame.Visible = false
    wait(1)
    for i = 0,1,0.1 do
        black.BackgroundTransparency = i
        wait(0.1)
    end
end

script.Parent.Parent.TextButton.MouseButton1Down:connect(onClicked)

end)

I cannot see the intro, After adding "game.Players.PlayerAdded:connect(function(player)", I need help

0
Is this a localscript? Netflixy 126 — 8y
0
Yes it is. ziploz 7 — 8y

1 answer

Log in to vote
0
Answered by
Netflixy 126
8 years ago

Assuming this is a local script, you do not need to use the PlayerAdded event. It should work perfectly fine.

local black = script.Parent.Parent
local title = script.Parent
local joingame = script.Parent.Parent.TextButton

    for i = 0,1,0.1 do
    black.BackgroundTransparency = i
    wait(0.1)

    if black.BackgroundTransparency == 1 then
    script.Parent:TweenPosition (UDim2.new(0.5, -100, 0.1, -25), "Out", "Quad", 1, true)
    joingame.Visible = true   
    end
end

function onClicked()
    for i = 1,0,-0.1 do
        black.BackgroundTransparency = i
        wait (0.1)
    end
    wait(2)
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.Classic
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
title.Visible = false
joingame.Visible = false
    wait(1)
    for i = 0,1,0.1 do
        black.BackgroundTransparency = i
        wait(0.1)
    end
end

script.Parent.Parent.TextButton.MouseButton1Down:connect(onClicked)

0
Great :D, but i want it to only go into them the FIRST time they spawn in. what about if i add "game.Players.PlayerAdded:connect(function(player) script.LocalScript:clone().Parent = player.CharacterAdded:wait() end)" will it work? ziploz 7 — 8y
0
Yes, you could just put the gui inside a PlayerAdded script inside of serverscriptservice, and on player added, clone the gui into theyr playergui. Make sure the localscript is disabled, and the clone gets enabled again. Netflixy 126 — 8y
0
Thanks so much :D ziploz 7 — 8y
Ad

Answer this question