I made a sanity check for the first time. Is this too much or do I need more?

This sanity check activates when the player touches the killblock(“GoldTrussFireEffect”).

I never made one before so I really don’t know if I’m doing it right or making a terrible mistake to my game.

This isn’t the whole script, and it’s located in ServerScriptService.

Thanks for reading my post. Any feedback would be very appreciated.

local nameValidationProcedures = {
	["GoldTrussFireEffect"] = function(part, humanoid, player)
		local correctColor = Color3.fromRGB(149, 141, 33)
		local correctShape = Enum.PartType.Ball 
		local correctMaterial = Enum.Material.Salt
		local correctTransparency = 1
		local correctReflectance = 0
		local correctSize = Vector3.new(4, 4, 4)
		local canCollide = true
		local canTouch = true
		local canQuery = true
		local castShadow = false

		
		if part.Color ~= correctColor then
			kickPlayer(player)
			return
		elseif part.Shape ~= correctShape then
			kickPlayer(player)
			return
		elseif part.Material ~= correctMaterial then
			kickPlayer(player)
			return
		elseif part.Transparency ~= correctTransparency then
			kickPlayer(player)
			return
		elseif part.Reflectance ~= correctReflectance then
			kickPlayer(player)
			return
		elseif part.Size ~= correctSize then
			kickPlayer(player)
			return
		elseif part.Anchored ~= true then
			kickPlayer(player)
			return
		elseif part.CanCollide ~= canCollide then
			kickPlayer(player)
			return
		elseif part.CanTouch ~= canTouch then
			kickPlayer(player)
			return
		elseif part.CanQuery ~= canQuery then
			kickPlayer(player)
			return
		elseif part.CastShadow ~= castShadow then
			kickPlayer(player)
			return
		end

		kickPlayer(player)
		local hasFire = false
		local hasTouchInterest = false

		for _, child in pairs(part:GetChildren()) do
			if child:IsA("Fire") then
				hasFire = true
			elseif child:IsA("TouchTransmitter") then
				hasTouchInterest = true
			end
		end

		if not hasFire then
			kickPlayer(player)
			return
		elseif not hasTouchInterest then
			kickPlayer(player)
			return
		end

		local fire = part:FindFirstChildOfClass("Fire")
		local fireColor = Color3.fromRGB(236, 139, 70)
		local fireSecondaryColor = Color3.fromRGB(139, 80, 55)
		local fireHeat = 25
		local fireSize = 25

		if fire.Color ~= fireColor then
			kickPlayer(player)
			return
		elseif fire.SecondaryColor ~= fireSecondaryColor then
			kickPlayer(player)
			return
		elseif fire.Heat ~= fireHeat then
			kickPlayer(player)
			return
		elseif fire.Size ~= fireSize then
			kickPlayer(player)
			return
		end

		
		humanoid.Health = 0
	end,
}

1 Like

Could you provide more details about what you’re trying to do? Are you trying to validate the properties of a kill block to ensure they haven’t been tampered with, or is there another purpose for these checks?

2 Likes

Simply, it’s to verify that the properties haven’t been tampered with and the script functions correctly. I think I might be overdoing it, but I’m not entirely sure.

1 Like

but if the player changed a block color on the client it willnot get changed on the server
does the player have ownership of that block or is it unanchored?

1 Like

You might not need to go to such lengths for verification. If you’re concerned about exploiters, which I’m assuming this script is for, remember that they can only modify things on their own client. The server and other players will still see the original properties, unless there’s some form of vulnerability in your game.

Focus on adding validation / sanity checks to info sent through things like remote events, as that’s where any real threats would be able to cause issues.

2 Likes

Currently, I’m not planning to allow players to modify the properties of any objects in the game. Also, the block is set to anchored.

1 Like

You can use tags to give different parts an identity while allowing them to have unique properties. This way, you can easily identify parts without needing to check every individual property.

1 Like

Thanks for your help. I just remembered that such a useful feature existed.

1 Like

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