Hello. I came with idea how to secure remote events. Basically you just make function
and creating new RemoteEvent via Instance.new
. And then destroying it when it done. For example
function Helper:Transiction(playerGui : PlayerGui)
local isDone = false
local bindableEvent = Instance.new("BindableEvent")
bindableEvent.Parent = script -- parent it to script or somewhere else
bindableEvent.Name = httpService:GenerateGUID(false) -- generate a random name
if isDone == false then
bindableEvent.Event:Connect(function ()
local starttime = tick() -- just making sure that remote event was used by using end time - start time.
playerGui.Transiction.Enabled = true
playerGui.Transiction.bg.UIGradient.Offset = Vector2.new(0, 1)
local i = game:GetService("TweenService"):Create(playerGui.Transiction.bg.UIGradient, TweenInfo.new(1.5), {
["Offset"] = Vector2.new(0, -1)
}) -- for example making tween
i:Play()
i.Completed:Connect(function ()
isDone = true
playerGui.Transiction.Enabled = false
local endTime = tick()
print("[Transiction]. Event:" ..bindableEvent.Name.. " was active for: ", endTime - starttime, "seconds") -- how many seconds it was active
end)
end)
bindableEvent:Fire() -- firing it
bindableEvent:Destroy() -- destroying
else
return ;
end
end
So. Is there any sense securing remote events. Or doing sanity checks is enough?