Weird memory spikes that occur shortly after the game starts

The server knows when the tween starts and how long it should last, and so it knows when it ends.

So should i use task.delay or something then? i don’t wanna do that because i want the tweens ending to be more accurate with the server

Any exploiter can hook the function/remote and return anything they would like

how am i supposed to stop that?

Task.delay would probably work well. You cant stop exploiters from exploiting, but you can set things up in a way so that them exploiting changes nothing. If remove you remove the remote and use task.delay, exploiters wont be able to do anything

also how is an exploiter going to find the exact remote to use or would they just pick a random remote?

Instead of asking the client what the property is, you can calculate what the property should be based off of the start time and current time. This would allow you to remove the GetProperty remoteFunction

They can use dex explorer or other methods to find your remotes. They can also view remote traffic and find your remotes through that. Currently due to byfron exploiting is much less widespread so I wouldn’t worry too much, but making things secure is always good practice.

i am worried about accuracy but i’ll still give this a try

Could i also make it check if there is an object before anything is returned?
or can exploiters just send in a random instance?

They could send anything, even malformed strings/numbers. You can do checks on the server but I think the best course of action would just be to remove the remote and find the property with information on the server.

you can calculate what the property should be based off of the start time and current time

function LocalTween:GetCurrentProperty(Property:string)	
	assert(getmetatable(self) == LocalTween, ErrorNotInstance:format("Play()", "LocalTween.new()"))
	--return GetProperty:InvokeClient(game:GetService("Players"):GetPlayers()[1], self.InstanceToTween, Property)
	if typeof(self.InstanceToTween) == "Instance" and typeof(Property) == "string" then
		return self.Goal[Property] / (self.CurrentTime / self.CurrentTweenInfo.Time)
	end
end

function LocalTween:Play()
	assert(getmetatable(self) == LocalTween, ErrorNotInstance:format("Play()", "LocalTween.new()"))
	TweenRemote:FireAllClients(self.CurrentTweenInfo, self.InstanceToTween, self.Goal, self.Remote)
	task.spawn(function()
		local TimeVal = 0
		while TimeVal < self.CurrentTime do
			TimeVal += task.wait()
		end
	end)
end

this should work right?

it’s supposed to get the information about an objects property on the client, hence the remote but again, i’ll try the suggestion you gave me

I would just get the starting time once and then just calculate the delta when you want to find the property.
I think your formula to find the current property is incorrect unless your goal is relative and the easing is linear.

oh yeah, so how would i calculate the delta then? if i ever use a non linear easing, also what do you mean by relative?

heres another image of a memory leak in action

so i changed the module to use threads instead of events and this still happens



this is the first time i started using coroutines and i was hoping they’d get garbage collected once i kill them and dereference them
The localtween model has been updated
and this is the extent of the server lag in my game by the way
image

I’ve also been getting an error called “Cannot close normal coroutine” when trying to destroy the thread which i don’t know why it’s happening and i can’t really get around it.