u/Fluffy-Recording9942

Advice for a beginner?

Hey so, i recently got into learning luau because ever since i was a kid i wanted to make a game.

With little prior experience (We're talking "download unity > try to make something > figure out you need scripts > try to learn > walk out knowing 0.01% of coding > forget > repeat several times over the years) i decided to actually sit and not follow any tutorial or ask any AI assistant to help me write something, instead i used documentation and forums to find formulas and try to solve my problems based on what i read.

I'm really happy with what i managed to write today, even though it's a tiny step into roblox development, it still is a step.

I would love to know how experienced dev manages to keep their syntax memory in place, if there are any practice sessions and how they eventually look like.

Here is the promised code (i put my heart into it 😄):

local button = script.Parent
local workspace = game:GetService("Workspace")
local sound = button:WaitForChild("Sound")
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = button
clickDetector.MaxActivationDistance = 10
clickDetector.MouseClick:Connect(function()
`local Materials = Enum.Material:GetEnumItems()`

`local randomMaterial = Materials[math.random(#Materials)]`

`local touched = false`

`local Shapes = Enum.PartType:GetEnumItems()`

`local randomShape = Shapes[math.random(#Shapes)]`

`local randomSize = math.random(1, 3)`



`local newPart = Instance.new("Part")`



`newPart.Size = Vector3.new(randomSize, randomSize, randomSize)`

`newPart.Position = Vector3.new(math.random(-3,3), math.random(1,5), math.random(-5,3))`

`newPart.Anchored = true`

`newPart.CanCollide = true`

`newPart.Material = randomMaterial`

`newPart.Color = Color3.new(math.random(), math.random(), math.random())` 

`newPart.Parent = workspace`

`newPart.Shape = randomShape`



`newPart.Touched:Connect(function(hit)`

`local Humanoid = hit.Parent:FindFirstChild("Humanoid")`

`if Humanoid and not touched then`

`touched = true`

`sound:Play()`

`if randomSize == 1 then`
Humanoid.Health -= math.random(1, 10)
print("Small damage applied", Humanoid.Health)
`elseif randomSize == 2 then`
Humanoid.Health -= math.random(10, 20)
print("Medium damage applied", Humanoid.Health)
`elseif randomSize == 3 then`
Humanoid.Health -= math.random(20, 99)
print("Big damage applied", Humanoid.Health)
`end`

`end`

`end)`

`wait(math.random(1, 10))`

`newPart:Destroy()`
end)

Any constructive criticism and mistakes pointed out will be highly appreciated!!

reddit.com