~~ [a password for events is needed so that attackers do not attack your game] ~~
example shown on GUI
~ Creating “BoolValue” and rename to “Status” ~
~ moving "Status’ to regular script ~
Regular Script:
local Debris = game:GetService("Debris") -- Debirs
script.Parent.MouseButton1Click:Connect(function() -- Click on button
local remPass = Instance.new("StringValue") -- passString
remPass.Parent = script
local genPass = math.random(0,999999) -- password
remPass.Name = genPass
remPass.Value = game.ReplicatedStorage.AntiFire.Name -- Way To RemoteEvent
Debris:AddItem(remPass,.5) -- timeDeletePassword
script.Status.Value = true -- Status Activated
task.wait(.1) -- using "local function" to remove the button cooldown
script.Status.Value = false -- status Deactived
end)
~ Local Script using for FireEvent ~
LocalScript:
local Debris = game:GetService("Debris")
script.Parent.ActivatedScript.Status:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.ActivatedScript.Status.Value == true then -- check status
for i,v in script.Parent:GetDescendants() do -- search pass file
if v.ClassName == "StringValue" and v.Value == game.ReplicatedStorage.AntiFire.Name then
local genPass = v.Name -- password to fire
game.ReplicatedStorage.AntiFire:FireServer(genPass) -- the event will check the codecode
end
end
end
end)
EventScript:
game.ReplicatedStorage.AntiFire.OnServerEvent:Connect(function(player, genPass)
for i,v in player.PlayerGui.ScreenGui.TextButton:GetDescendants() do -- search pass file
if v.ClassName == "StringValue" and v.Name == genPass then -- pass file
-- Code
end
end
end)
This offers minimal protection as exploiters can easily access both the password and the data transmitted through remotes. If you want to safeguard against exploiters triggering your remote events, it is crucial to ensure the validity of each request on the server side.
first off, passwords won’t add protection as exploiters can get it by a script, if it’s from the server, they can get to a client script that uses the remote and view the source, so it obviously won’t work
the password from the button is transmitted through RemoteEvent, and the correct password is only in the module, when the player presses the button, only if the password is generated and transmitted to the module, it is impossible to get the password without pressing the button, because it is in the module
This has to be one of the easiest password systems to bypass.
game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.TextButton.ActivatedScript.ChildAdded:Connect(function(child)
local password = child.Name
game:GetService("ReplicatedStorage").AntiFire:FireServer(password)
end)
Forgot to mention, when firing remotes faster than 0.1 seconds, packets will be dropped.
Also forgot to mention, make the instructions (and scripts) clearer.
You’ve clearly tried nothing. If you actually need to implement a password system then you need to rethink your codebase. Obviously you are using a classic SetMoney:Fire(1091991991919) remote form the client