SCRIPTING your own part! #ScrapMechanic LUA TUTORIAL! @BrentBatch
SCRIPTING your own part! #ScrapMechanic LUA TUTORIAL!  @BrentBatch
Uploaded January 2019 | Updated September 2026, 13 hours ago
This Scrap Mechanic tutorial covers: creating a basic scripted part with scripted input/output using a custom display! (UvFrameIndex)
(template lua code at the end of this description!)

Usefull links:
Scrap lua api: scrapmechanic.com/api/index.html
Learning lua syntax: lua.org/manual/5.1/manual.html
Uuid4 generator: uuidgenerator.net
Json validator: jsonlint.com
Online lua tester: rextester.com/l/lua_online_compiler


discord: discord.gg/BYnqasC


👥🗣Channel-links:
🔔youtube.com/c/brentbatch?sub_confirmation=1 🔔
turn notifications on to never mis out on anything! :D


✉ Brent.Batch@hotmail.com✉
👥twitter.com/BrentBatchYT👥
Steam group: steamcommunity.com/groups/Brentbatchyt


template lua code:

GenericClass = class( nil )
GenericClass.maxChildCount = -1
GenericClass.maxParentCount = 1
GenericClass.connectionInput = sm.interactable.connectionType.logic
GenericClass.connectionOutput = sm.interactable.connectionType.logic -- none, logic, power, bearing, seated, piston, any
GenericClass.colorNormal = sm.color.new(0xdf7000ff)
GenericClass.colorHighlight = sm.color.new(0xef8010ff)
--GenericClass.poseWeightCount = 1


--[[ client ]]
function GenericClass.client_onCreate( self )
end
function GenericClass.client_onRefresh( self )
self:client_onCreate()
end

function GenericClass.client_onSetupGui( self )
end

function GenericClass.client_onFixedUpdate( self, deltaTime )

end

function GenericClass.client_onUpdate( self, deltaTime )
end

function GenericClass.client_onDestroy( self )
end
function GenericClass.client_onInteract(self)
end
function GenericClass.client_canInteract(self)
end
function GenericClass.client_onProjectile( self, position, time, velocity, type )
end

--[[ server ]]
function GenericClass.server_onCreate( self )
end
function GenericClass.server_onRefresh( self )
self:server_onCreate()
end

function GenericClass.server_onFixedUpdate( self, deltaTime )

end

function GenericClass.server_onDestroy( self )
end
function GenericClass.server_onProjectile( self, position, time, velocity, type )
end
function GenericClass.server_onSledgehammer( self, position, player )
end
function GenericClass.server_onExplosion( self, position, destructionLevel )
end
function GenericClass.server_onCollision( self, other, position, velocity, otherVelocity, normal )
end
SCRIPTING your own part! #ScrapMechanic LUA TUTORIAL!Glitched collection #5 - windows [Scrap Mechanic HD]NEW GIF PLAYER! - [Scrap Mechanic HD]TRON! With Kan, Scrapman and Moonbo! [Scrap Mechanic HD]scrap mechanic - tank treads ! working! - proof of conceptTouchPad Dodge! w/ Durf, Rato & Icyfruit [Scrap Mechanic HD]Scrap Mechanic Battleships! With The Bearded BeastANTI-GRAVITY Pirate Ship! - [Scrap Mechanic HD]custom inputs for the paint gun! P4 [Scrap Mechanic LUA]LOGIC Messenger in Scrap Mechanic!HOW TO LOGIC minigame: SM-paint [Scrap Mechanic HD] [PART 1]Scrap Mechanic - rocket wave - wireless controll glitch
Brent Batch |

SCRIPTING your own part! #ScrapMechanic LUA TUTORIAL!

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER