I am trying to create a larger hitbox of the tool upon pressing the key E. I've tried changing the current hitbox of the tool in the script and I tried replacing the hitbox of the Tool with a hitbox that is bigger but both seem to cause the hitbox to fall off and go through the map.
the current part of the script I have now is:
game:GetService('UserInputService').InputBegan:Connect(function(input, process) if input.UserInputType == Enum.UserInputType.Keyboard and not process then if input.KeyCode == Enum.KeyCode.E and Player and character and Tool.Handle.Value.Value == 1 then Tool.Handle.Value.Value = 2 game.Debris:AddItem(Tool.Hitbox,0.1) local chkhitbox = game.ReplicatedStorage.ChakraHitbox:Clone() chkhitbox.CFrame = Tool.Handle.CFrame chkhitbox.Parent = Tool chkhitbox.Name = "Hitbox"
the weld script is
local RbxUtility = LoadLibrary("RbxUtility") local Create = RbxUtility.Create local Tool = script.Parent local Handle = Tool:WaitForChild("Handle") local function Weld(X, Y) local CJ = CFrame.nelw(X.Position) local C0 = X.CFrame:inverse()*CJ local C1 = Y.CFrame:inverse()*CJ local W = Create("Weld"){ Name = "Weld", Parent = X, Part0 = X, Part1 = Y, C0 = C0, C1 = C1 } end local function WeldObjects(parent) for i, obj in pairs(parent:GetChildren()) do if obj:IsA("Part") or obj:IsA("UnionOperation") then Weld(Handle, obj) obj.Anchored = false -- print("[Weld] Objects have been welded!") end end end Tool.Equipped:connect(function() WeldObjects(Tool) end) Tool.Unequipped:connect(function() WeldObjects(Tool) end)`
I say just remove the old one after cloning it. That way you get the weld, but don't have too many scripts when you test (or when u play, cuz it lags based on the items in the game).
Here, let me show u (I take it that they are both the same script):
game:GetService('UserInputService').InputBegan:Connect(function(input, process) if input.UserInputType == Enum.UserInputType.Keyboard and not process then if input.KeyCode == Enum.KeyCode.E and Player and character and Tool.Handle.Value.Value == 1 then Tool.Handle.Value.Value = 2 game.Debris:AddItem(Tool.Hitbox,0.1) local chkhitbox = game.ReplicatedStorage.ChakraHitbox:Clone() -- creating the part named "Hitbox" chkhitbox.CFrame = Tool.Handle.CFrame chkhitbox.Parent = Tool chkhitbox.Name = "Hitbox" script:Clone() -- Remove and clone the old script script:Remove() end end