Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Character can't teleport after being kicked from seat?

Asked by 4 years ago
Edited 4 years ago

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?

1local character = v.Character
2local humanoid = character.Humanoid
3-- Check if humanoid is sitting, and if so, set the 'Sit' property to false
4if humanoid.Sit then
5    humanoid.Sit = false
6end
7-- Teleport the character
8character:MoveTo(Vector3.new(0, 100, 0))
0
Do you mean Move to or teleport ? And i think Move TO is for humanoids. Coder_1 27 — 4y

1 answer

Log in to vote
0
Answered by
Coder_1 27
4 years ago

To teleport you simple change the Primary Part CFrame.

1local character = v.Character
2local humanoid = character.Humanoid
3-- Check if humanoid is sitting, and if so, set the 'Sit' property to false
4if humanoid.Sit then
5    humanoid.Sit = false
6end
7-- Teleport the character
8humanoid:MoveTo(Vector3.new(0, 100, 0))

To teleport

1local character = v.Character
2local humanoid = character.Humanoid
3local hrp = character.PrimaryPart
4-- Check if humanoid is sitting, and if so, set the 'Sit' property to false
5if humanoid.Sit then
6    humanoid.Sit = false
7end
8-- Teleport the character
9hrp.CFrame = CFrame.new(0,100,0)

Humanoid.Sit is a boolean a true or a false.

1if humanoid.Sit then
2      hrp.CFrame = CFrame.new(0,100,0)
3end

Hope this helps!

Ad

Answer this question