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

How would I weld a part from a model to my hands? (My welding remote isn't working)

So I'm making a weapon that has the handle welded to your hand. I made this remote event that doesn't seem to work.

local remotes = script.Parent

  
remotes.EquipRapier.OnServerEvent:connect(function(LocalPlayer)

local WeldedHand = LocalPlayer.Character.RightHand

local Rapier = game:GetService("ReplicatedStorage").Rapier:Clone()

local Handle = Rapier.Handle

local Weld = Instance.new("Weld",WeldedHand)

Weld.Part0 = WeldedHand

Weld.Part1 = Handle

end)

It doesn't seem to clone anything, for when I check workspace, nothing shows up. Even when I directly type game.Workspace.Rapier:Clone()into command bar while testing, nothing shows up. It isn't a name issue, nor is it me calling the remote incorrectly. There are no arguments for the client to call anyways.

If you could help, that would be great. Thanks.

2 comments

0

Because you aren't setting Rapier's parent

0

^^Rapier's parent is ReplicatedStorage, it is clearly stated in the second variable inside the remote.

1 answer

Hello there, i'll try to explain as much as i could.

Do not use:

local weld = Instance.new("Weld", <Parent>)

Use:

local weld = Instance.new("Weld")
weld.Part0 = <Part0>
weld.Part1 = <Part1>
weld.Parent = <Parent>

As this is Deprecated:

local  Weld =  Instance.new("Weld",WeldedHand)

which means it has delay Creating the weld, and the rest of the code is running, it can't set the properties if the weld isn't created at the first place.

And for the reason it isn't working now:

On line 08: any instance that is a clone, the user has to set a parent to it, it is not showing because the cloned part is waiting for a parent

You'll have to add this line;

Rapier.Parent = workspace --Change workspace to any parent you want

Hope this helped.

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