Hello, so I made this CocaCola can and when the player presses ‘E’ I want the can to be in his hand, but the problem is I do not know how to orientation it to always be held like a normal can. Can someone help me heres my code:
local event = game.ReplicatedStorage.RemoteEvents.Drink
event.OnServerEvent:Connect(function(player)
print("event from the server")
local character = player.Character
local cocaColaNew = game.ReplicatedStorage.CocaColaCan:Clone()
cocaColaNew.Position = character:WaitForChild("Right Arm").Position + Vector3.new(0,-1,0)
cocaColaNew.Orientation = Vector3.new(90, -180, 0)
cocaColaNew.Parent = workspace
local weld = Instance.new("WeldConstraint")
weld.Part0 = cocaColaNew
weld.Part1 = character:WaitForChild("Right Arm")
weld.Parent = character:WaitForChild("Right Arm")
local weld2 = Instance.new("Motor6D")
weld.Part0 = cocaColaNew
weld.Part1 = character:WaitForChild("Right Arm")
weld.Parent = character:WaitForChild("Right Arm")
cocaColaNew.Anchored = false
end)
Actually I fixed the problem but I still would appreciate if you could explain some of this I wanna improve as a scripter and some of these things like ‘angles, math.rad, and upVector’ caught me off guard.
Thank you this helped and so did the article I will try to learn more about it but I only before just knew about CFrame from exploit coding thanks for your fast response and help! Vouch.