Cheating prevention with my race system

So i made this Race system, I was wondering if exploiters will be able to change their race from the client like changing the stringvalue value. If so can you explain me how to prevent that?

local totalRarity = 0
for _, race in ipairs(races) do
	totalRarity = totalRarity + race.rarity
end

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local RaceValue = Instance.new("StringValue", character)

		local randomRarity = math.random(1, totalRarity)

		local selectedRace
		local cumulativeRarity = 0
		for _, race in ipairs(races) do
			cumulativeRarity = cumulativeRarity + race.rarity
			if randomRarity <= cumulativeRarity then
				selectedRace = race
				break
			end
		end

		RaceValue.Name = "Race"
		RaceValue.Value = selectedRace.name

		character["Body Colors"].HeadColor = selectedRace.skincolor
		character["Body Colors"].LeftArmColor = selectedRace.skincolor
		character["Body Colors"].RightArmColor = selectedRace.skincolor
		character["Body Colors"].LeftLegColor = selectedRace.skincolor
		character["Body Colors"].RightLegColor = selectedRace.skincolor
		character["Body Colors"].TorsoColor = selectedRace.skincolor

		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			humanoid.MaxHealth = selectedRace.health
			humanoid.Health = selectedRace.health
		end
	end)
end)

Exploiters will be able to change the string value of race on the client, however this does not replicate to the server (it will not carry over to the server) so the change will not be visible on the server.

Server: Human1
Exploiter changes to Human2

The server still sees: Human1
But any script on the client viewing it will see: Human2

This means the code you posted above should not be affected (assuming it is a server script). :+1:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.