This might be more related to the physics of Roblox. I'm making a feature where your character will teleport to a certain position. It checks to see if they are sitting, and if so, the 'Sit' property is set to false, and then the character is teleported. It teleports the character when they don't sit, but if they are sitting, it will only set the 'Sit' property to false, and not teleport them. Is there any way to get around this instead of a delay?
1 | local character = v.Character |
2 | local humanoid = character.Humanoid |
3 | -- Check if humanoid is sitting, and if so, set the 'Sit' property to false |
4 | if humanoid.Sit then |
5 | humanoid.Sit = false |
6 | end |
7 | -- Teleport the character |
8 | character:MoveTo(Vector 3. new( 0 , 100 , 0 )) |
To teleport you simple change the Primary Part CFrame.
1 | local character = v.Character |
2 | local humanoid = character.Humanoid |
3 | -- Check if humanoid is sitting, and if so, set the 'Sit' property to false |
4 | if humanoid.Sit then |
5 | humanoid.Sit = false |
6 | end |
7 | -- Teleport the character |
8 | humanoid:MoveTo(Vector 3. new( 0 , 100 , 0 )) |
To teleport
1 | local character = v.Character |
2 | local humanoid = character.Humanoid |
3 | local hrp = character.PrimaryPart |
4 | -- Check if humanoid is sitting, and if so, set the 'Sit' property to false |
5 | if humanoid.Sit then |
6 | humanoid.Sit = false |
7 | end |
8 | -- Teleport the character |
9 | hrp.CFrame = CFrame.new( 0 , 100 , 0 ) |
Humanoid.Sit is a boolean a true or a false.
1 | if humanoid.Sit then |
2 | hrp.CFrame = CFrame.new( 0 , 100 , 0 ) |
3 | end |
Hope this helps!