Hey! so I’m trying to script a system where two players can hug, However, One of the animations wont play and the person who has the emote on has a strange camera glitch, And for the life of me I cannot figure out how to fix either of them.
a good example of what i am trying to do is the dances in Fantasia (the ones that you can only use during the ball)
here is a video of my problem
And here is the script
local storage = game:GetService("ReplicatedStorage")
local event = storage.Duoemotes.Hug
local prompt = storage.Duoemotes.ProximityPrompt
local Hugged = storage.Duoemotes.Animations.Hug.q1
local Hugger = storage.Duoemotes.Animations.Hug.q2
event.OnServerEvent:Connect(function(Player1, playing)
if playing == true then
local char = Player1.Character
local seat = Instance.new("Seat")
local hug = prompt:Clone()
local weld = Instance.new("WeldConstraint")
local weld2 = Instance.new("WeldConstraint")
hug.Parent = seat
hug.ActionText = "Hug?"
seat.CFrame = char.Torso.CFrame
seat.Parent = char
seat.Anchored = true
seat.CanTouch = false
weld2.Parent = char
weld2.Part0 = char.Torso
weld2.Part1 = seat
weld.Parent = seat
weld.Part0 = seat
hug.Triggered:Connect(function(Player2)
local char2 = Player2.Character
weld.Part1 = char2.HumanoidRootPart
seat:Sit(char2.Humanoid)
hug.Enabled = false
local plr1 = seat.Parent.Humanoid.Animator
local plr2 = seat.Occupant.Animator
local anim = plr1:LoadAnimation(Hugged)
local anim2 = plr2:LoadAnimation(Hugger)
anim:Play()
anim2:Play()
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local hum = seat.Occupant
if hum then
local player = Player2
hug.Enabled = false
formerPlayer = player
else
hug.Enabled = true
formerPlayer = nil
weld.Part1 = nil
anim:Stop()
anim2:Stop()
end
end)
end)
elseif playing == false then
Player1.Character.Seat:Destroy()
Player1.WeldConstraint.Torso:Destroy()
end
end)
I know that there’s probably a lot of unnecessary lines, but this is what has been somewhat working for me so far.