Log in to vote
-1

Need some help with this script?

Asked by
steev 0
7 years ago

When the player touches a brick a countdown pops up for 30 seconds. When the countdown ends the player dies and the script ends.

Can anyone help me here? i have been given this script.

function NewGui()
    local Gui = Instance.new("ScreenGui")
    Gui.Name = "Countdown Gui"
    local Tect = Instance.new("TextLabel",Gui)
    Text.Name = "Countdown"
    Text.Size = UDim2.new(0.3,0,0.3,0) --Adjust size 
    Text.Position = UDim2.new(0,0,0,0) --Adjust position if wanted.
    return Gui
end
script.Parent.Touched:connect(function(Part)
    local Player = Game:GetService("Players"):GetPlayerFromCharacter(Part.Parent)
    if Player and not Player.PlayerGui:FindFirstChild("Countdown Gui") then
        local Gui = NewGui()
        Gui.Parent = Player.PlayerGui
        for i=30,0,-1 do
            Gui.Countdown.Text = i
            wait(1)
        end
        Player.Character:BreakJoints()
    end
end)

1 answer

Log in to vote
0
Answered by
AxeOfMen 434 Moderation Voter
7 years ago

Line 4 should be

local Text = Instance.new("TextLabel",Gui)
Ad

Answer this question