What do i use for soccer power tick() or values

Which one is better (Message Cap)

3 Likes

You can set values to tick() so basically using both works. If you wanna be able to access the time values from different scripts, then values are the better option.

1 Like

how would i use tick to make power

1 Like

So would you recommend making Value go up like every 0.01 Seconds and then the value is the power

1 Like

You would save the time at the start of the power buildup and then subtract it from the time at the release of the power buildup. Then you can use that time to multiply it by a power factor that would determine how much power the ball will be released at.

2 Likes

How would i do that im not really good with ticks. Ive never used them.

1 Like

How could i achieve that (Messenger Cap)

It’ll probably look something like this:

local power_factor = 2 -- set it to whatever you like
local powerBuildupStart = tick()

onRelease:Connect(function()
   local diff = tick() - powerBuildupStart
   local power = diff * power_factor -- power magnitude
   ball.LinearAssemblyVelocity = power * ball.CFrame.LookVector
end)

Is on realease where the mouse button 1 goesd up

Yes, you’ll probably have to use the InputService or ContextActionService for that.

local character = script.Parent
local UIs = game:GetService("UserInputService")
local kickpo = 2
local holding = false
local Start = tick()

		

	
		UIs.InputEnded:Connect(function(input)

				if input.UserInputType == Enum.UserInputType.MouseButton2 then
					holding = false
					local Duration = tick() - Start
					
					print(Duration)

				
				
		
	end
		
	

end)



Please do not use tick(), its old, and you would be better off using os.time(), or os.clock()

Whats the difference between time and clock

os.time() is the Current time under UTC Time

os.clock() is the CPU’s Uptime, Typically used for benchmarking

No one has said which one is better tho a value that goes up when you hold your mouse then thats the power or tick time/ os.time

How could someone answer that if you are “comparing fruits vs veggies”?

If a player holds a button and you start to record starter timestamp vs release timestamp its good.
What do you mean timestamp vs values? You should update the value on a basis, whats that basis? A loop? a RunService from Client/Server?

The method you are using to update the Value, you can use it to simply measure the holdTime, and trigger the kick based on that measure. If you take an extra step to use that update basis to update a value and after release read the value, just sounds like extra steps that are not needed at all.

Sorry i explained that badly. But which one should i use values or Ticks for power

How do you messure the hold time

i believe the holdTime is the time elapsed or the delta time (release-firstHold)

When player fires an event, store the os.time(), when player release get os.time() again and subtract the start time, thats all.

How you gonna handle the event? UserInputService?