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

How to script my tool??

I currently have a crowbar as a tool in my game. I want program it so that is destroys a certain part when I click the part. The part I want to destroy is a wood plank that is covering up a door. when I click on the plank with crowbar, it should destroy itself or the very lest disappear and be non collidable. Also, should the script go in the plank or the crowbar tool? Someone please help, its been a couple of days.

1 answer

Never mind, I solved it..... If anyone else is struggling to do this, here is what I did.

In the part I want to destroy upon click, I inserted a click detector and a script the script says

local tool = game.ServerStorage.Crowbar
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
	if plr.Backpack:FindFirstChild("Crowbar") then
		script.Parent.Anchored=false
		script.Parent.CanCollide=false
		script.Parent.Wood:Play()
		else
	end
end)

This script checks If i have a certain tool in my backpack which is in this case a crowbar. Then it proceeds with make the part unanchored and uncollidable. Also, a sound plays. MAKE SURE TO DELETE script.Parent.Wood:Play() IF YOU DO NOT WANT A SOUND TO PLAY OR ELSE YOU WILL GET AN ERROR

1 comment

0

If anyone finds a way to make my tool actually click to have the actions play please tell me. Right now a player has to unequip a tool and then click on the item for the actions to play.

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