How is my server checking?

So, essentially what I did, was make a ModuleScript for Swords (Simulator Game).
Is this good server checking, or is this pointless?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerEvents = ReplicatedStorage:WaitForChild('ServerEvents')
local ClickEvent = ServerEvents:WaitForChild('ClickEvent')

local DataStore2 = require(ReplicatedStorage:WaitForChild('DataStore2'))
local SwordTable = require(ReplicatedStorage:WaitForChild('SwordModule'))

ClickEvent.OnServerEvent:Connect(function(player, swordValue)
	local strengthDataStore = DataStore2("Strength", player)
	local swordInfo = SwordTable[swordValue]
	local passedName
	
	for _, v in pairs(player.Character:GetDescendants()) do
		if v:IsA('StringValue') then
			if v.Name == "Sword" then
				passedName = v.Value
			end
		end
	end
	
	if swordValue == passedName then
		strengthDataStore:Increment(swordInfo.Earnings)
	end
end)
1 Like

The check being done here isn’t necessary. If the sword is located under the player’s character, then there’s no need for swordValue to be passed to the server at all. The server already knows that there’s a sword attached to the character.

Since your remote increments a stat unchecked, any exploiter can repeatedly call it tens to hundreds of times per second and increment their Strength stat. You should look into debouncing the remote so that it aligns with the cooldowns you’d see on your player’s weapons. Additionally, you can design the game in a way where only clicks that land a hit with the sword give strength.

4 Likes