Mastering Roblox Coding: The unofficial guide to leveling up your Roblox scripting skills and building games using Luau programming by Kiepe Mark
Author:Kiepe, Mark [Kiepe, Mark]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2022-08-26T00:00:00+00:00
-- Checking if the user has provided feedback
if string.len(input) >= 3 then
-- Showing feedback recorded frame
givingFeedback.Visible = false
feedbackReceived.Visible = true
-- Resetting feedback textbox
textbox.Text = ""
else
warn("Cannot submit feedback less than 3
characters!")
end
end
function submitMoreFeedback()
givingFeedback.Visible = true
feedbackReceived.Visible = false
end
setup()
givingFeedback:WaitForChild("SubmitFeedback").MouseButton1Click:Connect(submitFeedback)
feedbackReceived:WaitForChild("Back").MouseButton1Click:Connect(submitMoreFeedback)
Let us take a look at the preceding local script. The setup() function simply changes the visibility of both Frames to ensure that only the GivingFeedback Frame is visible. Only having this Frame visible makes sense as we do not want to thank users for submitting their feedback without giving them the option to give feedback.
The submitFeedback() function gets executed once the .MouseButton1Click event fires on the SubmitFeedback button in our GivingFeedback Frame. Once the function starts, the user input is read by reading the .Text property. After that, we have an if statement that checks whether the string.len(input) function returns a value equal to or greater than 3 . The string.len() function returns the number of characters in a string. Therefore, the user needs to provide feedback containing at least three characters. If the user does this, the FeedbackReceived Frame will become visible, and the text in the TextBox will be set to an empty string.
Finally, we also have the submitMoreFeedback() function. This function gets executed once we click the Back button in our FeedbackReceived Frame. Once the player presses this button, the FeedbackReceived Frame becomes invisible, and the GivingFeedback Frame becomes visible again.
Obviously, our current code does not actually record the playerâs feedback. The reason for this is that it is out of our current scope. If you were to actually implement this system, you could use a Webhook or use Data Stores . In Chapter 8 , Building Data Stores , we will take a look at what Datastores are and what we can do with them.
Besides this, we also use the warn() function to notify the player that their feedback needs to be at least three characters. No player will ever look in the Developer Console to see this message. It is highly recommended you make something in your GUIs that allows you to give feedback depending on the actions players of our game take. It would be a great exercise to add this yourself.
We have now seen how TextButtons elements work. Besides this, we practiced making GUIs by using: Frames , TextLabels , TextBoxes , and TextButtons elements. We have also looked at switching between two Frames by using a LocalScript . In the next section, we will look at two more GUI elements: ImageLabel and ImageButton elements.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Blood, Sweat, and Pixels by Jason Schreier(3457)
Dawn of the New Everything by Jaron Lanier(2658)
Godot 4 Game Development Cookbook by Jeff Johnson(2231)
The Art of Doom by Bethesda(2012)
Significant Zero by Walt Williams(1854)
Creative Character Design by Bryan Tillman(1810)
World of Warcraft Chronicle Volume 3 by Blizzard Entertainment(1628)
The Ultimate Roblox Book by David Jagneaux(1601)
Art Of Atari by Tim Lapetino(1539)
Dawn of the New Everything: Encounters with Reality and Virtual Reality by Jaron Lanier(1515)
Pillars of Eternity Guidebook by Obsidian Entertainment(1504)
1628927445Game by Unknown(1453)
Unreal Engine 4 Virtual Reality Projects by Kevin Mack(1444)
Learning D by 2015(1395)
Unreal Engine Virtual Reality Quick Start Guide by Jessica Plowman(1395)
The Ultimate Player's Guide to Minecraft by Stephen O'Brien(1394)
Mission Python by Sean McManus(1376)
Unity 2018 By Example by Alan Thorn(1371)
Road Games by Road Games(1344)
