How to make a script that forbids touching objects expect for ones in a table

local whitelisted_objects = {workspace.part_that_i_touch}
	if part ~= whitelisted_objects then
		game:GetService("Players").LocalPlayer.Character.PrimaryPart.CFrame = part.CFrame.Position * 2

I don’t know how to this correctly this is my best attempted

basically before a part like bullet for example hits the player the players cframe will be set out of the parts reach
and the whitelist is so that the ground does not make the player float above it
and all parts not in the whitelist the player will be teleported away from before they can touch
the teleport location is barely out of the objects reach as if there was a wall pushing it away from said object

Put your parts in the whitelist as a dictionary:

local whitelisted_objects = {}
whitelisted_objects[workspace.part_that_i_touch] = true

This is different from what you have now because the default is to insert it at key [1], like an array. A dictionary is very fast when checking if it contains an object.

	if not whitelisted_objects[part] then --Check if part is not in the whitelist
		--Push player away