Need help scripting

local TimeText = script.Parent.TimeText
local Playing = script.Parent.Parent.Parent.Playing
local Time = 0
local MinTime = 6
while wait() do
if Playing.Value == true then
TimeText.TextColor3 = Color3.new(0.941176, 1, 0.25098)
TimeText.Visible = true
Time+=.03
TimeText.Text = Time…“s”
elseif Playing.Value == false then
TimeText.TextColor3 = Color3.new(0.329412, 1, 1)
if Time < MinTime then
script.Parent.Parent.Parent:Kick(“”)
end
Time = 0
end
end

there is no error but i want to make this: if player finished the parkour under 6 seconds player get kick.

this code make this; when i joining the game i get kick

this code in a gui, local script

1 Like

You will get automatically kicked because as soon as you join it’s already under 6 seconds and therefore kicks you. You should do a continuous loop to check.

local Time = 0
local Run = game:GetService("RunService")

Run.RenderStepped:Connect(funcion(step)
    Time += step
    if Time < 6 then
        if Playing == true then
            -- do stuff
            else
            -- do stuff
        end
    end
end)

try this.