Pretty hard to explain on words, id better show a video.
Script that makes countdown mulitply on touch ( like in T.O.H )
script.Parent.Touched:Connect(function(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not Player then return end
if table.find(Winners, Player.UserId) then return end
table.insert(Winners, Player.UserId)
TimerSpeed.Value = TimerSpeed.Value / 2 -- Speeds up timer
DoorMessage:FireAllClients(Player) -- Sends the win message in chat
MultiplierVisible.Value = true -- Makes the "x2" visible
Multiplies.Value = Multiplies.Value * 2 -- Shows the "x2" text
end)
basically, ever number that is >32 still counts as 32??
I’d recommend this solution or try finding a faster/accurate wait() method.
One thing you could do is use runservice.
local RunService = game:GetService("RunService")
local Speed = numberValue -- replace with the path of the number
local Cycle = time() + Speed.Value
RunService.Stepped:Connect(function()
if time() > Cycle then
-- update logic here, speed.value might be constantly changed and this will update automatically
Cycle = time() + Speed.Value
end
end)
This is probably because you did wait(1 / speed). wait resumes every second frame so that’s why it only runs at 32 fps. An alternative you can do is to use the deltaTime argument passed with RunService, which is the time elapsed from the previous frame:
local RS = game:GetService("RunService")
local timer = 100
local speed = 1
RS.Heartbeat:Connect(function(deltaTime)
timer -= deltaTime * speed
--[[
Decreasing the timer by "deltaspeed * speed" every frame.
For example, if deltaTime was 0.1, and speed was 4, it would
increase 4 times as fast: [0.1 * 4 = 0.4]
--]]
end
Player.ObbyCompleted:Connect(function() -- Not an actual function
speed *= 2
end)