I'm learning from Youtube Vid And I copied all of the script why isn't it Printing the Passed Time
local Player = game:GetService("Players").LocalPlayer local rp = game:GetService("ReplicatedStorage") local Combat = rp:WaitForChild("RemoteCombat") local UIS = game:GetService("UserInputService") local Debounce = false local cd = .25 local CurrTime = 0 local PrevTime = 0 UIS.InputBegan:Connect(function(input,isTyping) if isTyping then return elseif input.UserInputType == Enum.UserInputType.MouseButton1 then if Debounce == false then --Debounce = true CurrTime = tick() local PassedTime = CurrTime - PrevTime print(PassedTime) end end end)
Your question was very vague and I didn't understand it very well, but if you want a count to start when the player presses on the screen then I modified your script to that. For counting "For do" is the best option.
Here in this script it counts from 0 to 30
This is a LocalScript in StarterGui
local Player = game:GetService("Players").LocalPlayer local rp = game:GetService("ReplicatedStorage") local UIS = game:GetService("UserInputService") local debounce = false -- Here so that the player does not restart the count if it has already started local incrementTime = 1 -- how far the countdown progresses local startTime = 0 -- the number at which counting will begin local finalTime = 30 -- the final count number UIS.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then if debounce == false then debounce = true for count = startTime, finalTime, incrementTime do print(count) wait(1) --Speed at which the counting is done here in this case 1 second if count == 30 then debounce = false end end end end end)
I hope I have helped you