Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script not working correctly, not welding itself to the correct position. What's happening?

Asked by 5 years ago

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...

Answer this question