local password = 1235
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,key)
if (key ~= password) then
print(plr.Name.." tried to get access to an Event and failed!")
elseif (key == password) then
print(plr.Name.."knows the password!")
end
end)
i am basically setting password that only trusted people will know or only the script will know.
so hackers would require password to make any changes.
The only thing that you can do is remember to Never trust the client.
Instead you can include checks to see that the values inputted into the remotes are not something crazy that a script would ever put in. For example, if you had a remote that gives the player money, (DONâT, thatâs crazy), include checks to insure that when it should only be giving small amounts of money, that it doesnât suddenly ask the server to give the player 1000000.
@RedcommanderV2@RedDuck765 OP is matching a password sent through a remote with a password stored on the server Nobody can see this server value unless the game is leaked or somebody leaks the password. Regardless, exploiters do not have access to server scripts.
Do not use a key that can be easily shared to other people. People will be dishonest, that is just reality. Instead use an admin system, where you only allow players with UserIds that you manually add to a list serverside to use this remote.
This system could be bypassed even if you didnât look in the script using the NaN comparison trick due to how itâs structured. Since NaN always returns false in comparisons it could be used to completely evade this check like so
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,key)
if (key ~= password) then
print(plr.Name.." tried to get access to an Event and failed!")
elseif (key == password) then
print(plr.Name.."knows the password!")
end
print('Player either got the key or evaded it')
end)
There is. Not trusting the client will make your game 100% secure (speed hacks, aimbots, etc are a different story). You canât secure the client code, but your server code is unreadable to hackers and can be bulletproof.
Why are you trying to make a password for a remote event? Rather then comparing the passcode inputted why canât you just compare a usersId?
Example:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
if (plr.UserId ~= YOUR_ID) then
print(plr.Name.." tried to get access to an Event and failed!")
else
print(plr.Name.."knows the password!")
end
print('Player either got the key or evaded it')
end)
Could you put this in context as to what this is actually for? It states admin in your commenting which makes me believe that this is an event that could only be ran by admins (aka, you, etcâŚ)
You can do your best to secure your game by double checking server side whether or not remote calls are realistic. Do not give the client the ability to decide whether or not they have admin rights (such as through a password system).