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

How do I make parts weld onto a player?

Asked by
DVDKO 20
10 years ago

How do I make parts weld onto a player when they click a GUI button?

1 answer

Log in to vote
0
Answered by 10 years ago

You would use the

TextButton.MouseButton1Down:connect()

event for when a Text Button is clicked, you would then need to create a new part and position it

player = game.Players.LocalPlayer
x = Instance.new('Part',workspace)
x.CFrame = player.Character.Head.CFrame * CFrame.new(0,0,-5)

Then you would now need to weld the part to the players head, which can be achieved like this:

local w = Instance.new('Weld')
w.Name = 'Weld'
w.Part0 = player.Character.Head
w.Part1 = x
w.C0 = player.Character.Head.CFrame:inverse()
w.C1 = x.CFrame:inverse()
w.Parent = player.Character.Head

-- If I helped you leave a +1 Reputation <3

0
How would I put it all together? DVDKO 20 — 10y
Ad

Answer this question