Home   Search   Register  
Help Center  > Scripting Help  > Basic GoodBlox Lua For Beginners  
 
Display using:  
Previous Thread :: Next Thread 
 Author  Thread: Basic GoodBlox Lua For Beginners
sicklego9000 is offline. Last active: 7/20/2023 5:05:35 PM sicklego9000
Joined: 27 Nov 2020
Total Posts: 192
 
Basic GoodBlox Lua For Beginners
Posted: 09 Feb 2021 12:57 PM
Hello! In this forum post, I'll tell you the basics on GoodBlox's Lua.

------------------------------------

The Basics:

The thing you need to know while writing scripts is where an object is:
game - The game
game.Workspace - The game's Workspace
game.Workspace.Part - This is the location of an object called "Part" in the game's Workspace
game.Players - The Players Group in the game
game.Players.LocalPlayer - The player who activated the script inside the Players Group (LocalPlayer is replaced by the person's username)

------------------------------------

Modifying Objects:

You can modify an object's appearance by using Lua:

function onTouched() - A function called "onTouched"
game.Workspace.Part.Transparency = 0.5 - This changes the part's transparency to 0.5
end - ends the function

game.Workspace.Part.Touched:connect(onTouched) - If the Part is touched it triggers a function called "onTouched"

What this script does:

If an object called "Part" located in the game's Workspace (game.Workspace.Part) is touched (Touched:connect) it will trigger a function (onTouched) that changes the object's transparency to 0.5 (Transparency = 0.5)

--------------------

Here's another example using LocalPlayer:

function onTouched() - A function called "onTouched"
game.Players.LocalPlayer.PlayerGui.Sound.Volume = 0.5 - This changes a Sound's volume to 0.5 in the local player's PlayerGui.
end - - ends the function

game.Workspace.Part.Touched:connect(onTouched) - If the Part is touched it triggers a function called "onTouched"

What this script does:

If an object called "Part" located in the game's Workspace (game.Workspace.Part) is touched (Touched:connect) it will trigger a function (onTouched) inside the player who triggered the function's PlayerGui (game.Players.LocalPlayer.PlayerGui) and that makes an object called "Sound" in the PlayerGui volume 0.5 (PlayerGui.Sound.Volume = 0.5)

------------------------------------

It's kinda confusing, but I know you can do it!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
GoodBlox Forum  > Help Center  > Scripting Help  > Basic GoodBlox Lua For Beginners