Is this part of my script easily exploitable?

    local donePet = false
	local petInc = 0
	coroutine.wrap(function()
		repeat
			petModel:SetCFrame(CFrame.Angles(0,petInc/14.43,0)*CFrame.Angles(math.rad(-10),0,0))
			petInc += 1
			task.wait()
		until donePet
	end)()
	if not bool then wait(3) else wait(1.5) end
	donePet = true

Couldn’t an exploiter just do donePet = true right at the beginning? If so, what can I do to fix this?

You shouldn’t be worrying about the exploiter making visual glitches that only appear on their screen.
I don’t even believe it’s possible for them to change that value in the few frames they can.

Underneath this I do isHatching = false, and this only runs if isHatching is false.

hackers cant change variables unless they are global, so it is not exploitable.

Can exploiters change variables in scripts? - #2 by heII_ish what about this?

this can be exploited but it is incredibly easy to fix anyway, you can set up a debounce on the server so it will not let them open another egg until it is done hatching

local ratelimits = {}
openEgg.OnServerEvent:Connect(function(player,...)
	if not ratelimits[player] then
		ratelimits[player] = 0
	end
	if tick() - ratelimits[player] < 3 then--however many seconds to wait until they can open a new egg
		return
	end
	ratelimits[player] = tick()
	--rest of the egg opening code
end)

this could be done better but it works well enough

for i,v in next, getgc() do
	if typeof(v)=="function" and islclosure(v) and not is_synapse_function(v) then
		if getinfo(v).name == "OpenEgg" then
			setupvalue(v,1,true)
		end
	end
end

here’s a script that does exactly that

Ah, I never knew they had that much access. I thought they could only delete, clone, or do anything to local scripts but not change the variables inside. Thanks for that! But, if it is truly like this, there is no way to make it not exploitable besides handling things in the server part of the hatching, as @uwuCulturist said.

1 Like