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?

local character = v.Character
local humanoid = character.Humanoid
-- Check if humanoid is sitting, and if so, set the 'Sit' property to false
if humanoid.Sit then
    humanoid.Sit = false
end
-- Teleport the character
character: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.

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

To teleport

local character = v.Character
local humanoid = character.Humanoid
local hrp = character.PrimaryPart
-- Check if humanoid is sitting, and if so, set the 'Sit' property to false
if humanoid.Sit then
    humanoid.Sit = false
end
-- Teleport the character
hrp.CFrame = CFrame.new(0,100,0) 

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

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

Hope this helps!

Ad

Answer this question