0% found this document useful (0 votes)
25 views

Text 2

Uploaded by

Chicho J
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Text 2

Uploaded by

Chicho J
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

-- Get the necessary services

local TeleportService = game:GetService("TeleportService")


local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

-- Get the local player


local player = Players.LocalPlayer

-- Create a ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = player:WaitForChild("PlayerGui")

-- Create a TextLabel
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(0, 200, 0, 50)
textLabel.Position = UDim2.new(1, -210, 0, 10) -- Adjusted to be at the top-right
corner
textLabel.AnchorPoint = Vector2.new(1, 0) -- Anchored to the top-right corner
textLabel.Text = "10:00"
textLabel.TextScaled = true
textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
textLabel.TextColor3 = Color3.new(1, 1, 1)
textLabel.Font = Enum.Font.SourceSans
textLabel.Parent = screenGui

-- Make the TextLabel draggable (mouse and touch support)


local dragging = false
local dragInput, mousePos, framePos

local function updateInput(input)


local delta = input.Position - mousePos
textLabel.Position = UDim2.new(
framePos.X.Scale,
framePos.X.Offset + delta.X,
framePos.Y.Scale,
framePos.Y.Offset + delta.Y
)
end

textLabel.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or
input.UserInputType == Enum.UserInputType.Touch then
dragging = true
mousePos = input.Position
framePos = textLabel.Position

input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)

textLabel.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or
input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)

UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
updateInput(input)
end
end)

-- Set the countdown time (10 minutes in seconds)


local countdownTime = 10 * 60

-- Function to format time


local function formatTime(seconds)
local minutes = math.floor(seconds / 60)
local seconds = seconds % 60
return string.format("%02d:%02d", minutes, seconds)
end

-- Update the TextLabel with the initial time


textLabel.Text = formatTime(countdownTime)

-- Countdown loop
while countdownTime > 0 do
wait(1)
countdownTime = countdownTime - 1
textLabel.Text = formatTime(countdownTime)
end

-- Rejoin the game


local function rejoinGame()
local placeId = game.PlaceId
local jobId = game.JobId
TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
end

rejoinGame()

You might also like