How to safely invoke the client

I have no idea what your saying. If my method is bad, why can’t you bypass it?

Reading through again, I did misinterpret your solution a little on my end, my apologies.

Though I will say the use case is fairly low for something like this and the claim of exploiters not being able to mess with it anymore is a bit of an overstatement.

1 Like

If you didn’t want to cause damage to the server, couldn’t you use

pcall(function()

yes but they can still return wait and it will infinitely yield the server.

If you just use pcall, it will can be still be yielded infinitely by exploiter by simply return wait(9e9)

Like onclientonvokw and client returns the wait

Still waiting on that formatting…

Formatted the code

local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")

local urremoteevent = replicatedStorage.urremoteevent
players.PlayerAdded:Connect(function(plr)
	task.wait(2)
	local timeoutcount = 0
	local timeout = 5
	local result = nil
	task.spawn(function()
		local som = urremoteevent:InvokeClient(plr)
		if typeof(som) == "string" then
			result = som
		end
	end)
	repeat
		task.wait(1)
		timeoutcount = timeoutcount + 1
	until timeoutcount >= timeout or result ~= nil
	if result ~= nil then
		print(result)
	else
		plr:Kick("Unexpected behaviour : timeout reached")
	end
end)
1 Like

thanks for formatting I’ll add it to my topic with credit

1 Like

This reply is inherently misleading, due to the fact that gamje developers can still detect hookmetamethods and hookfunctions. There is a somewhat “safe” on the client, if you try hard enough.

Quote

This is very messy, I wouldn’t use this. Maybe you should make a module to wrap this code and make it prettier? You should also take advantage of coroutines to avoid a repeat task.wait(1) loop.

Yeah. I have wayy better methods now. I could make another updated topic if i had enough motivation

1 Like

I’m waiting for an updated topic (you’re welcome for the motivation :grinning:)

1 Like