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

How can I make player's Intro turned off if player dies once?

Asked by 8 years ago

I want to make player's starter intro turned off if player dies once after the intro ends.

wait(1)
b = script.Parent.TextLabel
wait(1)

b.Text = "W"
wait(0.2)
b.Text = "We"
wait(0.2)
b.Text = "Wel"
wait(0.2)
b.Text = "Welc"
wait(0.2)
b.Text = "Welco"
wait(0.2)
b.Text = "Welcom"
wait(0.2)
b.Text = "Welcome"
wait(0.2)
b.Text = "Welcome t"
wait(0.2)
b.Text = "Welcome to"
wait(0.2)
b.Text = "Welcome to t"
wait(0.2)
b.Text = "Welcome to th"
wait(0.2)
b.Text = "Welcome to the"
wait(0.2)
b.Text = "Welcome to the A"
wait(0.2)
b.Text = "Welcome to the Am"
wait(0.2)
b.Text = "Welcome to the Ama"
wait(0.2)
b.Text = "Welcome to the Amaz"
wait(0.2)
b.Text = "Welcome to the Amazi"
wait(0.2)
b.Text = "Welcome to the Amazin"
wait(0.2)
b.Text = "Welcome to the Amazing"
wait(0.2)
b.Text = "Welcome to the Amazing D"
wait(0.2)
b.Text = "Welcome to the Amazing Do"
wait(0.2)
b.Text = "Welcome to the Amazing Dog"
wait(0.2)
b.Text = "Welcome to the Amazing Doge"
wait(0.2)
b.Text = "Welcome to the Amazing Doge W"
wait(0.2)
b.Text = "Welcome to the Amazing Doge Wo"
wait(0.2)
b.Text = "Welcome to the Amazing Doge Wor"
wait(0.2)
b.Text = "Welcome to the Amazing Doge Worl"
wait(0.2)
b.Text = "Welcome to the Amazing Doge World"
wait(0.2)
b.Text = "Welcome to the Amazing Doge Wolrd!"
wait(1)
b.Text = "Welcome to the Amazing Doge World!_"
wait(1.2)
b.Text = "Welcome to the Amazing Doge World!"
wait(1.2)
b.Text = "Welcome to the Amazing Doge World!_"
wait(1.2)
b.Text = "Welcome to the Amazing Doge World!"
b.Parent.suchdoge:Play()
wait(1.2)
b.Text = "Welcome to the Amazing Doge World!_"
wait(1.2)
wait(0.01)
b.Text = "W2lc0M3 t0 tH3 4M4Zlng D0G3 W-0-r-l-d!"
b.Parent.bgm2:Play()
wait(8.593999999999999999994)
b.Parent.bgm2:Stop()
b.Text = "LEL sorry for u r ear terror m8"
wait(4)
b.Text = "SO nvm lets go to the DOGE WORLD(oh and no tutorial just do !!)"
wait(  3)
b.Text = "No loading loading screen is all fake"
wait(         2)
b.Text = "Removing The Gui...."
wait(2)
b.Text = ""
b.Parent.BackgroundTransparency = 1
--hm even i used Destroy() or Remove(),  it didn't work  so i use Transparency magic but still doesn't work. How can I make as the title?

3 answers

Log in to vote
0
Answered by 8 years ago

Answer: I recommend putting the StarterGui inside of the ServerScriptService with a script and make an function for the player added event. Then in the event clone the Gui and put it inside of the Player Gui and the player is already the argument of the function. Therefore, you can just clone the Gui under the script and place it inside of the PlayerGui. Then the function for placing the Gui into the PlayerGui will run once and that will be when the player joins only.

Thanks for reading my answer and I hope it helped you in one way or another.

~~ KingLoneCat

0
um.. can u plz tell me as code? sorry, cuz i can't understand this...(also i am foreigner) Sorry. Scripter_Blan 25 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

1st I think you need to look at how inefficient this code is, you have a lot of duplicated code which is not good at all.

This is simple to fix with functions, you can also use multiple functions for different tasks:-

--- just an example of how you can simply delay printing
local function delayedPrint(text, textLabel, tme)
    for i=1, #text do -- from the 1st character to the last character
        textLabel.Text = text:sub(1,i)
        wait(tme)
    end
end

-- an example of when the same text needs to be printed but with a delay and a repeate count
local function delayedTextSwitch(text1, text2, textLabel, del, repCount)
    for i=1, repCount do
        wait(del)
        textLabel.Text = text1
        wait(del)
        textLabel.Text = text2
    end
end

-- lastly but a list of istructions e.g. set text then wait go to thext index in the table
local function delayListProcess(textLabel, list)
    for i,v in pairs(list) do
        textLabel.Text = v['text']
        wait(v['delay'])
    end
end

-- this should folow the logic you posted in the original script but i have not tested it
local function runIntro()
    wait(1)
    local b = script.Parent.TextLabel
    wait(1)

    delayedPrint('Welcome to the Amazing Doge Wolrd!', b, 0.2)
    wait(1)

    delayedTextSwitch('Welcome to the Amazing Doge World!_', 'Welcome to the Amazing Doge World!', b, 1.2, 2)
    b.Parent.suchdoge:Play()

    wait(1.2)
    b.Text = "Welcome to the Amazing Doge World!_"
    wait(1.21)

    b.Text = "W2lc0M3 t0 tH3 4M4Zlng D0G3 W-0-r-l-d!"
    b.Parent.bgm2:Play()
    wait(8.593999999999999999994)
    b.Parent.bgm2:Stop()

    -- list logic
    local textList = {}
    table.insert(textList, {['text'] = 'LEL sorry for u r ear terror m8', ['delay'] = 4})
    table.insert(textList, {['text'] = 'SO nvm lets go to the DOGE WORLD(oh and no tutorial just do !!)', ['delay'] = 3})
    table.insert(textList, {['text'] = 'No loading loading screen is all fake', ['delay'] = 2})
    table.insert(textList, {['text'] = 'Removing The Gui....', ['delay'] = 2})
    table.insert(textList, {['text'] = '', ['delay'] = 0})

    delayListProcess(b, textList)

    b.Parent.BackgroundTransparency = 1
end

-- you can now use an if statement to check if the player had died e.g. a boolValue ect
-- there are lots of ways that you could do this so i cannot comment about this for your game
runIntro()

There are multiple ways that you can turn off the intro after the player dies but I do not know where you are running this scrip and how it is added to the player.

I hope you can see why I have change this code but pls comment if you do not understand how this works.

Hope this helps

Log in to vote
0
Answered by 8 years ago

Add this to the first line of your code:

local startergui = game.StarterGui
StarterGui.ResetPlayerGuiOnSpawn = false

That's all you have to do. If this worked - vote this answer up and accept it as an answer.

Answer this question