Dual wielding sword script help

I have been trying to make a weld script for 3 hours now and have made no progress. What i am trying to achieve is having a duel wielding sword but instead of using handles im trying to make it custom with welds. When i spawn into my game the weapons drop to the floor when i press 1 and i’m having a hard time trying to figure out how to attach them to both of my players hands when the tool is activated. Any help would be appreciated.

local s = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.Character
local LeftHand = char.LeftHand
local weld = Instance.new(“Weld”)

s.Activated:Connect(function()
weld.Part0 = s.Handle1
weld.Part1 = LeftHand
weld.Parent = s
end)

I know it probably makes no sense because i’m new to scripting this is just one of the weapons on the left hand.

Ahah, oh this made my cheer up a bit.
Okay so let me explain what you did wrong,
Tool.Activated’s description “The Activated event fires when the player clicks while a Tool is equipped”.
I suggest instead using Tool.Equipped which fires when the player’s tool is equipped.

1 Like

So you’re telling me all I’ve been doing for 3 hours was worthless, I feel so stupid. Thanks for the info I would have spent another 2 hours doing the same thing so I’m happy I made this post.

Put scripts in blocks like this:

image

It becomes:

local s = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.Character
local LeftHand = char.LeftHand
local weld = Instance.new(“Weld”)

s.Activated:Connect(function()
weld.Part0 = s.Handle1
weld.Part1 = LeftHand
weld.Parent = s
end)
2 Likes

Alright will do next time thanks.

I feel you, you’re not the only one here who makes mistakes (I am too);
Tho to stop this from happening just:

  1. Do some research on developer.roblox.com to check if what you’re using is the right thing.
    1.1 Or use the Object Browser (under the view tab)
  2. Get a friend who scripts just to help you with small things like this.
1 Like