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

How do i expand the size of a part without breaking the weld script?

Asked by 5 years ago
Edited 5 years ago

This is inside a local script

--//Service
local UIS = game:GetService('UserInputService')

--//Variables
local player = game.Players.LocalPlayer
local char = player.Character
local root = char:WaitForChild('HumanoidRootPart')

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.F then

    --//Box
    local hitBox = Instance.new('Part')
    hitBox.Anchored = false
    hitBox.CanCollide = false
    hitBox.Locked = true
    hitBox.Transparency = 0.5
    hitBox.Parent = char
    hitBox.Size = Vector3.new(5,1,5)
    hitBox.Name = 'hitBox'

    local weld = Instance.new('Weld',hitBox)
    weld.Part0 = root
    weld.Part1 = hitBox

    wait(1)

    --//Expand hitBox
    for i = 1,10 do
        hitBox.Size = hitBox.Size + Vector3.new(3,0,3)
        wait(0.01)
        end
    end
end)

I'm trying to make it so that when i press the f key, a box will appear and become welded onto my HumanoidRootPart and then expand in size. I am fully aware that increasing a part's size will break the weld but is there any way i can get around that and still make this script work the way i want it to?

0
use WeldConstraints User#23365 30 — 5y
0
Causes my character to glitch when i use WeldConstraint TheOneKingx 7 — 5y

Answer this question