#Move CountdownPart with Jeep
28 messages · Page 1 of 1 (latest)
like u could of used os.time instead of tick
and task.wait and not wait
lets see what to do for modifing the code will do
ok lets see what to do and ill see if i can shorten the code
ok almost kinda done remaking it and replaced somethings to make it kinda simple
so first of all lets see what ur code looks like if u change it then ill show the fixed script
so u go first before so i can compair the code to ur original then compair to ur new edit
then if thats not working ill create 3 different ones until one works
so what shows in output
ok ill show the first```lua
local carSeat = script.Parent
local countdownTxt = carSeat.Parent.CountdownPart.BillboardGui.Frame.timeLabel
local function countdownTimer()
local times = 11
while not carSeat.Occupant do
times -= 1
countdownTxt.Visible, countdownTxt.Text = true, tostring(times)
wait(1)
if times <= 5 then
countdownTxt.Text = times == 0 and "" or tostring(times) .. "!!"
countdownTxt.TextColor3 = times == 0 and Color3.new() or Color3.new(1, 0, 0)
end
if times == 0 then
carSeat.Parent:Destroy()
break
end
end
end
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then
countdownTxt.Visible, countdownTxt.Text = false, ""
return
end
countdownTimer()
end)
its ok if u still have ur system but a while loop can kinda break if u dont have a wait somewhere in the code
ok now im redoing it```lua
local carSeat = script.Parent
local countdownTxt = carSeat.Parent.CountdownPart.BillboardGui.Frame.timeLabel
local function countdownTimer()
local times = 11
local start = tick()
while not carSeat.Occupant do
times -= 1
countdownTxt.Visible, countdownTxt.Text = true, tostring(times)
wait(1)
if times <= 5 then
countdownTxt.Text = times == 0 and "" or tostring(times) .. "!!"
countdownTxt.TextColor3 = times == 0 and Color3.new() or Color3.new(1, 0, 0)
end
if tick() - start >= 10 then
carSeat.Parent:Destroy()
break
end
if times == 0 then
carSeat.Parent:Destroy()
break
end
end
end
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then
countdownTxt.Visible, countdownTxt.Text = false, ""
return
end
countdownTimer()
end)
changed one thing and that was the readding tick
** You are now Level 3! **
k
ok now lets see```lua
local carSeat = script.Parent
local countdownTxt = carSeat.Parent.CountdownPart.BillboardGui.Frame.timeLabel
local function countdownTimer()
local times = 11
local start = tick()
while not carSeat.Occupant do
times -= 1
countdownTxt.Visible, countdownTxt.Text = true, tostring(times)
wait(1)
if times <= 5 then
countdownTxt.Text = times == 0 and "" or tostring(times) .. "!!"
countdownTxt.TextColor3 = times == 0 and Color3.new() or Color3.new(1, 0, 0)
end
if tick() - start >= 10 then
carSeat.Parent:Destroy()
break
end
if times == 0 then
carSeat.Parent:Destroy()
break
end
end
end
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then
countdownTxt.Visible, countdownTxt.Text, countdownTxt.TextColor3 = false, "", Color3.new()
return
end
countdownTimer()
end)
so why not do somthing like if times = 0 then change the color
back to what it started
so after the ```lua
if times == 0 then
-- change back the color
break end
lol thats a easy fix
local carSeat = script.Parent
local countdownTxt = carSeat.Parent.CountdownPart.BillboardGui.Frame.timeLabel
local function countdownTimer()
local times = 11
local start = tick()
while not carSeat.Occupant do
times -= 1
countdownTxt.Visible, countdownTxt.Text = true, tostring(times)
wait(1)
if times <= 5 then
countdownTxt.Text = times == 0 and "" or tostring(times) .. ""
countdownTxt.TextColor3 = times == 0 and Color3.new() or Color3.new(1, 0, 0)
end
if tick() - start >= 10 then
carSeat.Parent:Destroy()
break
end
if times == 0 then
carSeat.Parent:Destroy()
countdownTxt.TextColor3 = Color3.new() or Color3.new() -- change the 2nd for the Original Color
break end
end
end
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then
countdownTxt.Visible, countdownTxt.Text, countdownTxt.TextColor3 = false, "", Color3.new()
return
end
countdownTimer()
end)```
well thats odd
ok i think this might work but dont know
local carSeat = script.Parent
local countdownTxt = carSeat.Parent.CountdownPart.BillboardGui.Frame.timeLabel
local function countdownTimer()
local times = 11
local start = tick()
local originalColor = countdownTxt.TextColor3
while not carSeat.Occupant do
times -= 1
countdownTxt.Visible, countdownTxt.Text = true, tostring(times)
wait(1)
if times <= 5 then
countdownTxt.Text = times == 0 and "" or tostring(times) .. ""
countdownTxt.TextColor3 = times == 0 and Color3.new() or Color3.new(1, 0, 0)
end
if tick() - start >= 10 then
carSeat.Parent:Destroy()
break
end
if times == 0 then
carSeat.Parent:Destroy()
countdownTxt.TextColor3 = originalColor
break
end
end
end
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then
countdownTxt.Visible, countdownTxt.Text, countdownTxt.TextColor3 = false, "", Color3.new()
return
end
countdownTimer()
end)
well that sucks
local carSeat = script.Parent
local countdownTxt = carSeat.Parent.CountdownPart.BillboardGui.Frame.timeLabel
local function countdownTimer()
local times = 11
local start = tick()
local originalColor = countdownTxt.TextColor3
while not carSeat.Occupant do
times -= 1
countdownTxt.Visible, countdownTxt.Text = true, tostring(times)
wait(1)
if times <= 5 then
countdownTxt.Text = times == 0 and "" or tostring(times) .. ""
countdownTxt.TextColor3 = times == 0 and Color3.new() or Color3.new(1, 0, 0)
end
if tick() - start >= 10 then
carSeat.Parent:Destroy()
break
end
if times == 0 then
carSeat.Parent:Destroy()
countdownTxt.TextColor3 = countdownTxt.TextDefault
break
end
end
end
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then
countdownTxt.Visible, countdownTxt.Text, countdownTxt.TextColor3 = false, "", Color3.new()
return
end
countdownTimer()
end)
one more time i hope