Hi Ducksneedhelp!
I had a similar issue to you.
For beginner scripters, it's best to start with something simple; like changing BrickColors, printing, etc. Work your way up and read/watch tutorials that actually TEACH you how the script works. if you have a script that is having an error, you can always ask this website. This will also help you understand why you made mistakes.
No script can be too complicated if you learn how they work. Here are some functions that will definitely be useful when scripting:
Print Function: Will print x in the output. This is mainly used for debugging, where the script is erroring.
Example
Output:
Hello!
x = number it starts at;
y = number it will end at;
z = number it goes up/down by.
Example
The value of "i" will start at 0, and it will keep going up by 2 until "i" reaches 10.
Output:
0,
2,
4,
6,
8,
10
This function, instance.new() makes a new instance, and becomes a child of y.
Example 1
1 | Instance.new( "Folder" , game.ServerStorage) |
This creates a Folder into the ServerStorage.
Example 2
1 | Instance.new( "BoolValue" , game.ReplicatedStorage) |
This creates a BoolValue (Boolean Value aka True or False statement) into ReplicatedStorage.
Here are simple, intermediate, and complicated scripts:
Simple: Change BrickColor
1 | local part = script.Parent |
3 | part.BrickColor = BrickColor.new( "New Yeller" ) |
Intermediate: Changing the Transparency of everything inside the model
1 | local model = script.Parent |
2 | for i, v in pairs (model:GetChildren()) do |
Complicated: Datastores
01 | local ds = game:GetService( "DataStoreService" ) |
02 | local ds 1 = ds:GetDataStore( "CashDataStore" ) |
03 | local ds 2 = ds:GetDataStore( "WinsDataStore" ) |
05 | game.Players.PlayerAdded:Connect( function (player) |
07 | local stats = Instance.new( "Folder" ) |
08 | stats.Name = "leaderstats" |
12 | local Cash = Instance.new( "IntValue" ) |
15 | Cash.Value = ds 1 :GetAsync(player.UserId) or 0 |
16 | ds 1 :SetAsync(player.UserId, Cash.Value) |
19 | local Wins = Instance.new( "IntValue" ) |
22 | Wins.Value = ds 2 :GetAsync(player.UserId) or 0 |
23 | ds 2 :SetAsync(player.UserId, Wins.Value) |
26 | Cash.Changed:Connect( function () |
27 | ds 1 :SetAsync(player.UserId, Cash.Value) |
30 | Wins.Changed:Connect( function () |
31 | ds 2 :SetAsync(player.UserId, Wins.Value) |
You can always go to this website to get more information.
Hope I helped,
LennyPlayzYT