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

How do I make a Tool that makes truss?

I want to make a script where if someone clicks with the tool a truss will appear and then remove itself I dont know why it is not working I put a click detector on the tool and I want the truss to go to the players position.

script.Parent.ClickDetector.MouseClick:Connect(function(playerWhoClicked)
	local new = Instance.new("TrussPart")
	new.Position = playerWhoClicked.leftleg.Position
	new.Size = 2,25,2
	new.Parent =  game.Workspace
	wait (20)
	new:Destroy()
end)

Please answer!!!! Thank you if you do!

3 comments

0

playerWhoClicked.Character["Left Leg"].Position anyways I made an answer (fixed line 3)

0

:/

0

Thank you!

2 answers

✓ Accepted answer

The problem is your using a function you would for a ClickDetector, what you want to use is a function for a tool which is called Activated Tool.Activated

script.Parent.Activated:Connect(function(playerWhoClicked)
    local new = Instance.new("TrussPart")
    new.Position = playerWhoClicked.leftleg.Position
    new.Size = 2,25,2
    new.Parent =  game.Workspace
    wait (20)
    new:Destroy()
end)

4 comments

0

line 3 is still not working but thank you

0

im pretty sure its ["Left Leg"] not lefteg, but replace "playerWhoClicked.leftleg.Position" with "Cframe.new(script.Parent.Parent["Left Leg"].Position" )

0

tooo late

0

Thank you

At line 3 leftleg has a space and is know as Left Leg it is also in the character not the player

    new.Position = playerWhoClicked.Character["Left Leg"].Position -- line 3

But that's not fixed is it? remember we need to use cframes here

new.CFrame.new(playerWhoClicked.Character["Left Leg"].Position) 

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