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

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

Asked by 7 years ago
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

Log in to vote
0
Answered by 7 years ago
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.

0
He doesn't even understand basic syntax, you should explain it all to him more. TheDeadlyPanther 2460 — 7y
Ad

Answer this question