I am currently working on a gun system but I had stumbled upon an issue unfixable. Naturally I went to the dev forum and many stated I couldn’t fix my code due to the messiness.
I’m trying to rewrite it right now adding configurations into it but I don’t know how I would do that without making it messy as currently I have to check what gun is sending the remote event every time with if statements.
Problem is, if I remove that if statement and leave it up to the local script, the obvious issue is exploiters. I just want a way to check the gun from the server without making the script messy/
Use module scripts that would return stats, put them in replicated storage and access them from both server and client.
So basically something like this?
local config = {
["Pistol"] = {
FireMode = "Manual",
damage = 10,
firerate = 0.5,
animid = "rbxassetid://13112812781"
}
}
return config
Yea but you can just return the table directly
return {
["Pistol"] = {
FireMode = "Manual",
damage = 10,
firerate = 0.5,
animid = "rbxassetid://13112812781"
}
}
1 Like
When firing the remote, send the gun stats with it, and on the server compare it with the table expected, and if they are not equal then its an exploiter
1 Like