Hello, I have a coca cola can here and would like to weld it to their hand when ever they press e here is my code I do not know where to start or how to do this. If you could help me that would very appreciated!
local uis = game:GetService(“UserInputService”)
local player = game.Players.LocalPlayer
local character = player.Character
local cocaCola = game.ReplicatedStorage:WaitForChild(“CocaColaCan”)
uis.InputBegan:Connect(function(input, gameProccessedEvent)
if input.KeyCode == Enum.KeyCode.L then
if cocaCola then
print("coca cola")
character.HumanoidRootPart.Anchored = true
local cocalColaNew = cocaCola:Clone()
cocalColaNew.Parent = workspace
end
end
end)
I think you should not anchor the HumanoidRootPart either due to the fact that it will just freeze the player in position. Then, you can also just do cocalColaNew.Position = character.LeftArm (or right depends on you). After that, you can do + Vector3.new(0,2,0) and mess around with it to get it in the hand.
Sorry I forgot to remove the anchor it was for my reset script and I know I needed to anchor the humanoid root part to stop it from moving. And thanks I’ll try this!
haha thanks I knew how to do it but I for some reason thinking I had to replace some of the animations in the player for some reason then I relised I was just being stupid. lol
You wanted the player to hold the drink, correct? Whenever you open the Animation Editor for a rig and put the arm up to hold the drink, the 3 dots will appear. If you hover over them you should see “Set Animation Priority”. You then click on Action so that the player can walk around and have the drink in his/her hand with their arm up, resembling a tool.