Untitled
unknown
plain_text
2 years ago
866 B
3
Indexable
local finishLine = script.Parent
local timePassed = 0
local raceActive = true
local function finish()
print("Touched the finish line")
if timePassed <= 5 then
print("You won a diamond medal!")
elseif timePassed <= 10 then
print("You won a gold medal")
elseif timePassed <= 20 then
print("You won a silver medal!")
elseif timePassed <= 30 then
print("You won a bronze medal")
else
print("You are a turtle")
end
raceActive = false
end
local function partTouched(whatTouches)
local character = whatTouches.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid and raceActive == true then
finish()
end
end
finishLine.Touched:Connect(partTouched)
while raceActive == true do
task.wait(1)
timePassed = timePassed + 1 --increase timePassed by one
print("Since race started " .. timePassed .. " seconds passed")
endEditor is loading...
Leave a Comment