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

How to teleport after countdown?

I already have a GUI Countdown script that looks like this


local this = Instance.new("IntValue", game.Workspace)
this.Value = 300 --Change 300 to round seconds
this.Name = "Timer"
_G.timer = this
while true do
	_G.timer.Value = 300 --Change 300 to round seconds for 5 minutes
repeat
_G.timer.Value = _G.timer.Value - 1
wait(1)	
until
_G.timer.Value == 0
end

But I need it to teleport it to a certain brick after its done counting down

1 answer

✓ Accepted answer

Here is a way to make your life easier, Make one MAIN SCRIPT for your game it's much easier, Make a ScreenGui with a TextLabel. Then put a StringValue into ReplicatedStorage name it StatusValue, Put this script into the TextLabel.

ReplicatedStorage = game:GetService("ReplicatedStorage")
Status = ReplicatedStorage.StatusValue


script.Parent.Text = Status.Value
Status.Changed:connect(function()
script.Parent.Text = Status.Value
end)

Then you put a Regular Script into workspace and write your code in there, So let me get you started with your countdown.

ReplicatedStorage = game:GetService("ReplicatedStorage")
Status = ReplicatedStorage.StatusValue

for i = 300,1,-1 do -- Change 15 to how long you want to countdown
  Status.Value = i
   wait(1)
end

for _. player in pairs(game.Players:GetPlayers()) do
    player.Character.Torso.CFrame = CFrame.new(Spawn.Location) -- If you are loading a map then put a brick called **Spawn ** if not either put the position of a brick or 'game.Workspace.Brick.Position'
end

end

I have not checked this but it should work, If it doesn't work then I might've did something wrong. Hope this helps!!

2 comments

0

The script just says 300 and stays at 300 and doesnt countdown

0

I just noticed that there are a phew mistakes in the script I will fix them now, Please remove my vote.

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