I’m doing testing on my FPS game, and wanting to make sure exploiting ain’t possible when it comes to firing a gun. So I’m doing the shooting mechanics purely client sided, and then just doing checks on server to make sure its allowed/etc.
Server side check when firing a gun
--// Bullet fired, return to all client
local function Fire(player, weapon, start, target, speed, drop)
local Data = player:FindFirstChild("Data")
if not Data then return end
if not FindWeapon(player, weapon) then return end -- Player is trying to use a weapon they don't own
local TeamColor = TeamColors[CollectionService:GetTags(player)[1]].Color
--// Checks for hacks \\--
local WeaponFolder = Weapons:FindFirstChild(weapon)
if WeaponFolder then
local ConfigFolder = WeaponFolder:FindFirstChild("Config")
if ConfigFolder then
if speed ~= ConfigFolder.Speed.Value or drop ~= ConfigFolder.Drop.Value then
player:Kick("YOU ARE HACKING!!")
end
end
end
-- Prevent double bullet on player end
for _, v in pairs(Players:GetPlayers()) do
if v ~= player then -- Make sure v isn't the same as the player who sent the request
BulletFired:FireClient(v, weapon, start, target, speed, drop, TeamColor)
end
end
end
Example of server view. Server has no view of guns/projectiles.
However, projectiles do load between clients, as I’d assume this would be better for performance sake
Still unsure what’s best in terms of loading weapons (client or server?)