Find the Button Game in Roblox.

by nunutheoni in Living > Video Games

1697 Views, 0 Favorites, 0 Comments

Find the Button Game in Roblox.

Room1.jpg
Instructables find the Button.

This craft will show you how to make a Roblox find the button game with a simple script. For the uninitiated a find the button type of game is exactly what it sounds like, the player goes from small rooms with hidden buttons to progress to the next stage. The find the button game started life in Minecraft maps and can be found on other games like Fortnite but today we are going to make a one in Roblox. (My demo find the button game)

Supplies

ROBLOX_Studio_icon.png

The only needed supplies for this project is the free Roblox studio. Roblox studio is a good place to develop games because Roblox has a large player base and many tutorials for learning scripting. Another positive is that both scripting and modeling can be done in Roblox so there will be no proprietary software to make a full find the button game. This tutorial for the studio will introduce Tween and Click detectors which will be elaborated on below.

Making a Good Button

MadeButton.jpg
ButtonSetup-bspline.jpg

0.25, 0.75, 0.75 studs button - The part actually used to transport the player contains the script and a click detector.

0.175, 1, 1 studs base - Used more for aesthetics can be resized to be larger or smaller in comparison to the button.


The largest part of a find the button game is the button itself, I used the design of a kind of cartoon button that would usually have a large sign that says DO NOT PRESS above it. For the materials of the button, I just used simple plastic material because it doesn't draw too much attention to the button (Although the red button already draws a lot of attention). Lastly, an important part that the button needs is a hierarchy with 1. the button and base grouped together and 2. The button contains a click detector to see when the player finds the button and a script to dictate what happens when the button is clicked which will be transporting the player from room to room. IMPORTANT NOTE - IF YOUR PARTS HAVE DIFFERENT NAMES, THEN PARTS IN THE SCRIPT MUST BE CHANGED.

Defining Variables

Tween.gif
local TweenService = game:WaitForChild("TweenService")
local Click = script.Parent:WaitForChild("ClickDetector")
local Button = game.Workspace.Button:WaitForChild("Button")


One of the most important parts of scripting in Roblox or any scripting language that have information that can call for parts in the game. Firstly calling for the TweenService, TweenService is a Roblox feature that makes smooth movement between 2 positions. Click and Button are variables that reference the click detector and the button itself so the script can detect a click and set that it's the button that moves.

Defining Part Movement

Start.jpg
Goal.jpg
local start = {}
start.Position = Vector3.new() -- Put button's own position
local tweenInfo1 = TweenInfo.new(0.4)
local tween1 = TweenService:Create(Button, tweenInfo1, start)


local goal = {}
goal.Position = Vector3.new() -- Put button's own position
local tweenInfo2 = TweenInfo.new(0.4)
local tween2 = TweenService:Create(Button, tweenInfo2, goal)


start.Position - The position in the property tab of where the button is when unpressed

goal.Position - The position in the property tab of where the button will be when pressed


The TweenService was defined above in the variables section so the next step is to define what the moving part will do. The first 2 lines are too define how the part will change but in our case, it will only set the position. If you wanted to set other parameters of the tween you could for example put: goal.Color = Color3.new(0, 170, 0). Then the color of the button would turn green (although it has some strange effects). Next, the tween Infos set how long it will take to go up or down so going up or down could take different amounts of time. Lastly, tween1 and 2 create the actual tween using the info from the variables defined.

Making the Button and the Player Move

Change.gif
Click.MouseClick:Connect(function(player)
	tween2:Play()
	wait(0.6)
	tween1:Play()
	local char = player.Character or player.CharacterAdded:Wait()
	char.HumanoidRootPart.CFrame = CFrame.new() -- Set desired position
end)


Now to finish up the script by making it all work, there is a function activated when the click detector is activated by a player. Then the second tween is activated next for a very important step the wait sign, the weight signal needs to be longer than the TweenInfo defined or the second tween of the button going up will move up before going fully down. Finally, to set the player's new position set down a new part put it where you want them, and get the position (It can be deleted afterward). Now you can test out the button and manipulate values.

Making Rooms

Room1.jpg
Room2.jpg
Room3.jpg

Now, this is the place where you can design the rooms and where to place buttons just remember to update button positions and the location of the following room (Note - If buildings are falling apart hit ctrl + a to select all parts and hit anchor). Above are rooms I made to demonstrate building themes.


Thank you for reading!