Tool: Equip + click = deploy handle. Click again to get back

Hey!
I need help!
I wanted to make a tool with a handle. If you click with it, you clone the handle and drop it 5 studs infront of your rootpart.
If you click again, the handle destroys and is back in your hand. How would i do that?
I tried it a few times by using clicked qnd activated events, but it isnt working.

PLEASE HELP!

TYSM!

1 Like

You can use CFrame’s LookVector, BoolValue, and Tool.Activated.

2 Likes

How would that look in a serverscript?

1 Like

Can you post the script that you used? Also are there any errors?

1 Like

I dont hsve any script so i cant

1 Like

This forum might help you with LookVector

How did you make that thingy blue???

3 Likes

Use this format: [text](link)

1 Like

Oooo thats cool. Why didnt discobot teach me that?

1 Like

I figured it out by searching up in the devforum too.

1 Like

You want something like this?!

Yeaaaaa thqts exqctly what i need! Wow! How to get that???

If you would now provide the code of it, you solved my problem, so i can mark it as solution

here is a very simple script to how to do that

--// Var //--

local Player 	= game:GetService("Players").LocalPlayer --// getting the localplayer

local character = Player.Character or Player.CharacterAdded:Wait() --// Waiting for character of the localPlayer

local Tool		= script.Parent --// Getting the tool

local IsDroped  = false --// debounce

local Clone_Drop_Part 

--// function //--

function drop_The_part() --// function for the part to drop
	if not IsDroped then --// checking if it is not Droped
		IsDroped = true --// Puting the debounce to be true (Droped = true)
		
		Clone_Drop_Part  	       = Tool.Handle:Clone() --// Cloning the Part (Handle)
		--// Chaning The CFrame (Position) of the Cloned Part to be 5 studs infront of your HumanoidRootPart //--
		Clone_Drop_Part.CFrame     = character:WaitForChild("HumanoidRootPart").CFrame + character:WaitForChild("HumanoidRootPart").CFrame.LookVector * Vector3.new(5, 0, 5)
		
		--// Put the Handle Part to be invisible (Transparency = 1)
		Tool.Handle.Transparency   = 1
		
		--// Put the Cloned Part CanCollide = true
		Clone_Drop_Part.CanCollide = true
		
		--// Put the Parent of the Cloned Part to workspace
		Clone_Drop_Part.Parent     = workspace
	else
		IsDroped = false --// Puting the debounce to be false (Droped = false)
		if Clone_Drop_Part then --// checking if there is a Part(Cloned) in the workspace 
			Tool.Handle.Transparency = 0 --// Put the Handle Part to be visible (Transparency = 0)
			Clone_Drop_Part:Destroy() --// Destroing the Part(Cloned) from the workspace 
		end
	end
end

--// event //--

Tool.Activated:Connect(drop_The_part) --// Player Click on the tool

Tell @discobot this.

how to make a preview of the part, like a selectionbox?

Tool.Deactivated:Connect(drop_The_part) --// Player Click again on the tool

That wont work, already tried.