Hey guys, so im trying to make a “Domain Expansion” from Jujutsu Kaisen.
[I’m taking a lot of inspiration from a game called Jujutsu Shenanigans to make the stuff tbh]
But my problem is that when i try to teleport the players/npcs to the area, these just don’t teleport and stay in the same place they were.
I put the players that got hit by a hitbox [GetPartBoundsInRadius] on a table
local PlayersHit = {}
local Hitbox = workspace:GetPartBoundsInRadius(RootPart.Position, Range, Params)
for i,Part in pairs(Hitbox) do
if Part.Parent:FindFirstChild("Humanoid") and not table.find(PlayersHit, Part.Parent) then
table.insert(PlayersHit, Part.Parent)
local Enemy = Part.Parent
local EnemyHumanoid = Enemy:FindFirstChild("Humanoid")
local EnemyPlr = Players:FindFirstChild(Enemy.Name)
EnemyHumanoid.WalkSpeed = 0
EnemyHumanoid.JumpPower = 0
if EnemyPlr then
PropagandaRemote:FireClient(EnemyPlr, "Whiteout", 3.2)
PropagandaRemote:FireClient(EnemyPlr, "Theme", "Limitless", "Play")
PropagandaRemote:FireClient(EnemyPlr, "FOV", 120, 3.6)
end
print(PlayersHit)
end
end
And then i use the table to teleport them.
for _, Char in pairs(PlayersHit) do
local EnemyHumanoid = Char:FindFirstChild("Humanoid")
local EnemyRoot = Char:WaitForChild("HumanoidRootPart")
local Magnitude = RootPart.Position - EnemyRoot.Position
Char:MoveTo(AreaClone.UserSpawn.Position - Magnitude)
print("Teleported ".. Char.Name)
task.wait()
EnemyHumanoid.WalkSpeed = 16
EnemyHumanoid.JumpPower = 50
local EnemyPlr = Players:FindFirstChild(Char.Name)
if EnemyPlr then
PropagandaRemote:FireClient(EnemyPlr, "No Whiteout", 2)
PropagandaRemote:FireClient(EnemyPlr, "FOV", "Normal", 2)
end
end
Idk what’s the problem, i don’t get any errors in console
I already tried by changing HumanoidRootPart’s CFrame and didn’t work either
Everything happens on a ModuleScript that get’s called from a Server Script
Hi again
When calculating magnitude you need to add .magnitude at the end so like this
local Magnitude = (RootPart.Position - EnemyRoot.Position).Magnitude
Maybe this will work, if not lmk!
(Edit)
Oh wait that will not work because it will turn into a number.
I believe :MoveTo requires you to use the humanoid rather then the character, so maybe try
Hi
Yeah, it prints it correctly.
Idk what’s happening tbh
Somehow im the only one getting teleported correctly, i even tried with some friends to check if it’s a Dummy thing but they don’t get teleported too, just sometimes…
I feel I have experienced this in the past too strangely. I think the moveto: function is broken (Could be wrong) or something. I think the solution would be to move the characters with CFrame, thats atleast what I do now. Downsides with that is I believe the moveto will teleport the character on top of a part if they get teleproted inside the part. But if your teleporting them somewhere open it should be fine. What you can do is this