This is code that spaws Soda and attaches it to player. The problem is that first time the function is called it spaws Soda is wrong orientation. Second times it's called it's as intended.
Images for reference: image1, image2
local items = {} function items.get(player, item) local successful = false local object, pos, ang local animation = Instance.new("Animation") if player.PlayerData.Item.Value == nil then --Get item type if item == "Soda" then object = game:GetService("ServerStorage").Soda animation.AnimationId = "http://www.roblox.com/Asset?ID=5162117084" pos = CFrame.new(0,-1.3,0) ang = Vector3.new(0,0,-90) end local arm = player.Character["Right Arm"] --Spawning and position local clone = object:Clone() clone.Anchored = false clone.Parent = arm player.PlayerData.Item.Value = clone clone.CFrame = arm.CFrame:ToWorldSpace(pos) clone.Orientation = ang local weld = Instance.new("WeldConstraint") --Weld parts weld.Parent = clone weld.Part0 = arm weld.Part1 = clone --Animation local animationTrack = player.Character.Humanoid:LoadAnimation(animation) animationTrack:Play() successful = true end return successful end return items
If you want to get past the problem of it not working first time what you want to do is call the function first, delete the soda, then call the function again and hopefully the soda should be in the correct place.
So I think I figured it out. I swapped right arm for torso and adjusted the position and rotation and it worked. Thanks @Gooncreeper for contribution