How to make building keybinds?

The title isn’t the great, I know.

any who, Do any of you know how I would go about making a building system? If you do know, can you possibly link me a dev hub post? I don’t know what to search up to find my needs on there.when a button on the keyboard is pressed, it shows the hologram, then when the player clicks, it turns into a real building.

If you don’t know what I mean, here is a GIF:

https://i.gyazo.com/1c1cfde0da93257db4101b1b990c7cae.gif

yes gotta flex with my “amazing” building" skills :sunglasses::sunglasses:

As you can see by the GIF, when i press a button, there is a hologram, then when clicked it become the object, (wall, floor, stair)
Any help at all would be very helpful! Thanks for taking about 30 seconds out of your day to read this!

joke

EDIT: so someone said I was trying to make a copy of strucid. Not I just want a simple house building game.

Uh, I’m not much experienced with this kind of system but I’m guessing you can hook the userinputservice when the editing mode is turned on.

local Connection
local Player = game:GetService('Players')
local EditMode = false
local KeyCodes = {
	[Enum.KeyCode.E] = 'Wall',
	[Enum.KeyCode.F] = 'Ramp'
}

local function Editing(bool)
	EditMode = bool
	if bool == true then
		Connection = game:GetService('UserInputService').InputBegan:Connect(function(input,gpe)
			if not gpe then --no one cares about game events go away
				if KeyCodes[input.KeyCode] then
					print(KeyCodes[input.KeyCode])
				end
			end
		end)
	else
		Connection:Disconnect()
		Connection = nil
	end
end


game:GetService('UserInputService').InputBegan:Connect(function(input,gpe)
	if not gpe then
		if input.KeyCode == Enum.KeyCode.Q then
			print('ye boi')
			Editing(not EditMode)
		end
	end
end)

if this is bad, don’t hate. I’m not really familiar with this kind of system. This is just how I’d go about it tbh.

3 Likes

you can use this link to learn more on the api

1 Like