Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do weld a object to a torso at the touch of a key [Shift]?

game.Workspace.Boost = "Boost"
player.Character = Player

if keypressed [f]

Instance.new(Weld)

while true 

boost = player

Sorry I really dont know how to script Help

1 answer

function Weld(part0,part1,c0,c1)
	local cre = LoadLibrary('RbxUtility').Create
	
	local weld = cre('Weld'){Part0=part0;Part1=part1;C1=c1;C0=c0;}
	weld.Parent = part1

	return weld
end

local input = game:GetService('UserInputService')
local players = game:GetService('Players')
local player   = players.LocalPlayer

Input.InputBegan:connect(function(input,onGui)
	if onGui then return end
	
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode = Enum.KeyCode.LeftShift then
			local char = player.Character or player.CharacterAdded:Wait()
			local torso = char:WaitForChild('Torso')

			local FirstPart = torso
			local SecondPart = game.Workspace.Part --// Change to your path

			Weld(FirstPart,SecondPart,CFrame.new(0,0,0)) --// Change CFrame to your desired offset
		end
	end
end)

I haven't tested this but it should work.

1 comment

0

He doesn't even understand basic syntax, you should explain it all to him more.

This discussion is preserved as it was. New answers, comments, and votes are closed.