I’m trying to create a part when a player gets touched by another player. He’s the section of code that creates the part. It creates the part, but the part gets placed on top of the characters head. I want the part to basically ‘trap’ the player (basically how TwoShue’s freeze tag game used to work) so the player gets trapped in like a block of ice.
The part where the player actually gets trapped is done simply by anchoring their character so it cannot move at all (e.g. Character.HumanoidRootPart.Anchored = true).
The freeze parts are just visual and may also be used as the hitbox for thawing a player.
Also, just some tips:
Set the CFrame of freezePart, not the position, otherwise it may just go on top of the character (Roblox clipping stuff, not sure what state it is in rn).
Disable CanCollide on freezePart so the character won’t glitch out of the part when it gets created, and so their camera and stuff can leave the part too
I would be using CFrame for your case rather than trying to use a Vector3 (from the character’s torso’s position).
The difference between Vector3 and CFrame is that Vector3 forces some sort of collision detection on your system. CFrame on the other hand uses a completely separate method that is more reliant 3D space of the game rather than applying some sort of collision system.
You can read up more over here: http://wiki.roblox.com/index.php?title=CFrame
The solution is simple, just replace the line where you assign the position:
Yup, if FindFirstChild() returns nil, you are still calling .CFrame and you will still get an error. I’d recommend either checking to make sure the result isn’t nil (before you even create the freeze part).