local whitelisted_objects = {workspace.part_that_i_touch}
game.Players.LocalPlayer.Character.PrimaryPart.Touched:Connect(function(part)
if part ~= whitelisted_objects then
game:GetService("Players").LocalPlayer.Character.PrimaryPart.CFrame = part.CFrame.Position * 2
end
end)
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