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

Ctrl + click unanchor part?

Hi guys, I need a ctrl + click unanchor part script, I do not know how to do it.

2 answers

✓ Accepted answer

Hey, what AlexTheCreator said is a way to do it, but not the 'right' way. What you need to do is make a LocalScript, put it in StarterGui or StarterPlayer>StarterPlayerScripts. You need to put this code in the script:


local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local UIS = game:GetService("UserInputService")
local CTRLisBeingPressed = false

UIS.InputBegan:connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftControl then
		CTRLisBeingPressed = true
	end
end)

UIS.InputEnded:connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftControl then
		CTRLisBeingPressed = false
	end
end)

Mouse.Button1Down:connect(function()
	if CTRLisBeingPressed == true then
	 local Obj = Mouse.Target;
     	local unanchor = Obj.Anchored
		if unanchor ~= nil then
			Obj.Anchored = false
		end
	end
end)

If you have any other questions, please tell me.

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