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

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

Asked by 5 years ago

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.

0
Because you aren't setting Rapier's parent Rare_tendo 3000 — 5y
0
^^Rapier's parent is ReplicatedStorage, it is clearly stated in the second variable inside the remote. xForVowels 6 — 5y

1 answer

Log in to vote
0
Answered by
Divistern 127
5 years ago
Edited 5 years ago

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.

Ad

Answer this question