part = script.Parent
part.Touched:Connect(function(hit)
local humanoid = hit.parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
local hed = hit.parent.Head
part.CFrame = hed.CFrame * CFrame.new(0,10,0)
local weld = Instance.new("Weld", part)
weld.Part0 = hed
weld.C0 = hed.CFrame:Inverse()
weld.Part1 = part
weld.C1 = part.CFrame:Inverse()
part.Anchored = false
end
end)
This script I made isn't working. It's supposed to make the part stick to your head when you touch it, but it welds itself really far away from the head and I don't know what's wrong! Please help! Also, I'm new to scripting and this website so I'm probably going to make a lot of mistakes here and there...