Im trying to make 2 player emotes, and theres currently an issue
local MaidModule = require(game.ReplicatedStorage:WaitForChild("Modules"):WaitForChild("Maid"))
EmoteMaster.PlayAnim = function(P1, P2, Emote)
if not P2 then return end
if not script:FindFirstChild(Emote) then return end
local Character1
local Character2
if P1:IsA("Player") then
Character1 = P1.Character
else
Character1 = P1
end
if P2:IsA("Player") then
Character2 = P2.Character
else
Character2 = P2
end
local Hum1 : Humanoid = Character1:FindFirstChildOfClass("Humanoid")
local Hum2 : Humanoid = Character2:FindFirstChildOfClass("Humanoid")
if not Hum1 then return end
if not Hum2 then return end
warn("Loading Emote: "..Emote)
if (Hum1.RootPart.Position - Hum2.RootPart.Position).Magnitude > 10 then
warn("Too Far Away")
return
end
local Canceled = false
local Maid = MaidModule.new()
local Emote = require(script[Emote])
Hum1.RootPart.Anchored = true
Hum2.RootPart.Anchored = true
local Between = CFrame.lookAt((Hum2.RootPart.CFrame.Position + Hum1.RootPart.CFrame.Position) / 2, Hum1.RootPart.CFrame.Position)
game.Workspace.FartPart.CFrame = Between
task.wait(1)
Hum1.RootPart.Position = Between.Position+Emote.P1Offset
Hum2.RootPart.Position = Between.Position+Emote.P2Offset
task.wait(1)
if Emote.Stare then
Hum2.RootPart.CFrame = CFrame.lookAt(Hum2.RootPart.Position, Between.Position)
Hum1.RootPart.CFrame = CFrame.lookAt(Hum1.RootPart.Position, Between.Position)
end
task.wait(1)
local Anim1 : AnimationTrack = Hum1.Animator:LoadAnimation(Emote.P1Animate)
local Anim2 : AnimationTrack = Hum2.Animator:LoadAnimation(Emote.P2Animate)
Anim1:Play(0.05, 1, 1)
Anim2:Play(0.05, 1, 1)
Maid.Hum1Move = Hum1:GetPropertyChangedSignal("MoveDirection"):Once(function()
Anim1:Stop()
Anim2:Stop()
Hum1.RootPart.Anchored = false
Hum2.RootPart.Anchored = false
Canceled = true
end)
Maid.Hum2Move = Hum2:GetPropertyChangedSignal("MoveDirection"):Once(function()
Anim1:Stop()
Anim2:Stop()
Hum1.RootPart.Anchored = false
Hum2.RootPart.Anchored = false
Canceled = true
end)
task.delay(Anim1.Length, function()
if Maid then Maid:Destroy() end
if not Canceled then
Hum1.RootPart.Anchored = false
Hum2.RootPart.Anchored = false
end
end)
end
So im getting the central point of the 2 players and making them face that point, the issue is that the offsets will reset the orientation of the players.
Example:
I want the players to teleport equally to an average of both their locations, right now they teleport to the exact same rotation every time.