I would do what @alessdai said. That’s what I do and it works everytime.
It is a server script:
local TweenService = game:GetService("TweenService")
local rightHinge = script.Parent.RightDoor.RightDoorHInge
local leftHinge = script.Parent.LeftDoor.LeftDoorHinge
local info = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local openLeft = TweenService:Create(leftHinge, info,{CFrame = leftHinge.CFrame*CFrame.Angles(0,math.rad(270),0)})
local closeLeft = TweenService:Create(leftHinge, info,{CFrame = leftHinge.CFrame})
local openRight = TweenService:Create(rightHinge, info,{CFrame = rightHinge.CFrame*CFrame.Angles(0,math.rad(90),0)})
local closeRight = TweenService:Create(rightHinge, info,{CFrame = rightHinge.CFrame})
local function animateFridge(plr, fridge)
local character = plr.Character
if not character or not character.Parent then
character = plr.CharacterAdded:Wait()
end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local reachForDrink = Instance.new("Animation")
reachForDrink.AnimationId = "rbxassetid://9216051516"
local reachForDrinkTrack = animator:LoadAnimation(reachForDrink)
openLeft:Play()
openRight:Play()
task.wait(0.5)
reachForDrinkTrack:Play()
reachForDrinkTrack.Stopped:Wait()
task.wait(0.5)
closeLeft:Play()
closeRight:Play()
end
game.ReplicatedStorage.FireDrinks.FireButterTea.OnServerEvent:Connect(animateFridge)
game.ReplicatedStorage.FireDrinks.FireButterTea.OnServerEvent:Connect(function(plr)
local drink = game.ServerStorage.Items.Drinks.ButterTea
local clone = drink:Clone()
clone.Parent = plr.Backpack
end)
It didn’t work when I tried it.
How would I get that? I tried this:
local humanoidRootPart = plr.Character.Humanoid:WaitForChild("HumanoidRootPart")
but it didn’t work because it couldn’t find the HRP.
The HumanoidRootPart is actually in the player itself rather than the Humanoid. An example reference would be player.Character.HumanoidRootPart
Although anchoring the HumanoidRootPart isn’t my personal preference for doing something like this for multiple reasons, if you’re looking to accomplish this it should work alright.