Scripting help with my taser tool (Mouse.Target)

Hi, I’m currently working on a taser tool and I want to use the Mouse.Target statement to allow the person to click on the player from a distance.

But I also want it to attach ‘prongs’ to a player. I want them to be connected from the taser and the person but I want it to move with them (so it’s not rigid) but I’m not sure how.

4 Likes

You can use a weld to attach the prongs to the player model, and then use a ropeconstraint for the wires.

Do you want the connection wire to appear to all players all only to client (you) ?

I want it to not be able to drag the player

I’d like it to be all players if possible (and I’d like it so that the player can’t be dragged and it sort of gets longer as you walk away

You can increase the length of the ropeconstraint as the player gets farther away.

1 Like

Then it gets a bit more complex,
You need to know how to use client-server model for this
Basically you will make 2 scripts that one of them handles the mouse target and the other to make the connection

How would I get it to do that? Also is there a way to keep the rope from going underground?

Here’s a simple script to do those things, assuming you already have a ropeconstraint setup…

local DISTANCE_OFFSET = 0.5
local TargetPart, Player
while wait() do
    RopeConstraint.Length = (TargetPart.Position-Player.Character.PrimaryPart.Position).Magnitude + DISTANCE_OFFSET
end

It lags out when I attach the constraint to a player from my tool

Is this exactly what you try to succeed?

If so here is the place that has the tool
Taser Tool.rbxl (20.3 KB)

Unfortunately i am using “Beam” Instance in my case so there is no way to prevent the “wires” to go underground UNLESS you set the offset to < 1.2 (Currently it is 1.5 or something)

1 Like