What happens when the player picks up the ball
I’m trying to make a script where, when the player touches a ball, the player picks it up (the ball sticks to the player’s hand). Now I found out you need to use welds for this, which I did and it works, except there is one issue. The ball is behind the player instead of in the right hand.
This is my script, I got it from a few tutorials:
part = game.Workspace.Ball
part.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
local character = player.Character
local weld = Instance.new("WeldConstraint")
weld.Part0 = part
weld.Part1 = character.RightHand
weld.Parent = character
end
end)
I know you have to use a CFrame, but I don’t know how it works and how you would put it in this script, can someone please explain it to me with an example script?