Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Having issues working with Tick?

Asked by
yurhomi10 192
10 years ago

Trying to work with the Tick() function but not working?

tick = 0  
while game.Workspace.Brick.Parent == Workspace do 
wait(1) 
tick = tick + tick() 
print(tick)
end

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

You are overriding the function tick in your first line!

Use a different name for the current time!


You can see a similar thing here:

print(wait);
-- It's initial value:
-- function: 0x231b970
-- something!
wait = 1;
print(wait);
-- Value now:
-- 1
-- The function was lost!

tick, like any other name, is just a variable, so your assignments to tick are overwriting its useful initial value.

Also, tick() returns current time since a certain point. It is essentially never meaningful to increment a value by the current time as you are attempting in the snippet you posted.

Ad

Answer this question