As you can see I’m beginner I basically learned whatever I need to make this thing in roughly a month. While I had UI Design experience before never did it on Roblox. For the scripting side I come from JS and C# I haven’t took good hold of lua yet I get basic concepts but I have no grasp of how to write “good code” many best practices are common for different languages in similar paradigms but lua is a bit different than others with ways of same things being done which makes it a bit challenging. Also there are Roblox’s own ways of doing some things which feels off/weird.
Most challenging task for me is fighting against the broken physics if something doesn’t go right it’s the annoying physics, many things in my game actually don’t use the Roblox’s physics engine but stage them with cframes to look like they are getting affected from physics. I don’t know how to effectively use Roblox’s physics engine properly.
Here is an example script from the game, more or less all of my scripts are like in similar style:
local Intro = {}
function Intro.jumpGlide(player : Player)
local isRagdollEnabled = Instance.new("BoolValue")
isRagdollEnabled.Name = "isRagdollEnabled"
isRagdollEnabled.Value = false
isRagdollEnabled.Parent = player.Character
local isIntroSequence = Instance.new("BoolValue")
isIntroSequence.Name = "isIntroSequence"
isIntroSequence.Parent = player.Character
isIntroSequence.Value = true
local humanoidRootPart : BasePart = player.Character:FindFirstChild("HumanoidRootPart")
local humanoid : Humanoid = player.Character:FindFirstChild("Humanoid")
if humanoidRootPart == nil then
player:Kick("Critical error has occured: You do not possess a HumanoidRootPart ")
return
end
if humanoid == nil then
player:Kick("Critical error has occured: You do not possess a Humanoid")
return
end
humanoid.PlatformStand = true
humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.CFrame.Position + Vector3.new(0, 1000, 0))
humanoid.WalkSpeed = 0
stateChangerKeeper = humanoid.Changed:Connect(function(old: Enum.HumanoidStateType, new: Enum.HumanoidStateType)
local anyPartsUnderUs = workspace:Raycast(humanoidRootPart.CFrame.Position, humanoidRootPart.CFrame.Position + Vector3.new(0, -4, 0))
if anyPartsUnderUs == nil then
return
end
if anyPartsUnderUs.Instance.Parent:FindFirstChild("Humanoid") ~= nil then
return
end
humanoid.PlatformStand = false
isIntroSequence.Value = false
isRagdollEnabled.Value = true
bodyVelocity:Destroy()
humanoid.WalkSpeed = 16
humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.CFrame.Position)
attachment0:Destroy()
attachment1:Destroy()
fallTrail:Destroy()
stateChangerKeeper:Disconnect()
player.PlayerGui.GameUI.IntroDirect.Visible = false
end)
bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = Vector3.new(0, -464, 0)
bodyVelocity.P = 1
bodyVelocity.Parent = humanoidRootPart
-- Effects
fallTrail = Instance.new("Trail")
fallTrail.Transparency = NumberSequence.new(1, 0.5)
fallTrail.MaxLength = 7
attachment0 = Instance.new("Attachment")
attachment0.Parent = humanoidRootPart
attachment1 = Instance.new("Attachment")
attachment1.Parent = humanoidRootPart
attachment1.Position = Vector3.new(1, 0, 1)
fallTrail.Parent = humanoidRootPart
fallTrail.Attachment0 = attachment0
fallTrail.Attachment1 = attachment1
-- humanoidRootPart.CFrame = humanoidRootPart.CFrame * CFrame.Angles(180, 0, 0)
player.PlayerGui.GameUI.IntroDirect.Visible = true
player.PlayerGui.GameUI.IntroDirect.MouseButton1Click:Connect(function()
local anyPartsUnderUs = workspace:Raycast(humanoidRootPart.CFrame.Position - Vector3.new(0, -80, 0), humanoidRootPart.CFrame.Position + Vector3.new(0, -4000, 0))
if anyPartsUnderUs ~= nil then
isIntroSequence.Value = false
isRagdollEnabled.Value = true
local teleportPosition = anyPartsUnderUs.Position
humanoidRootPart.CFrame = CFrame.new(teleportPosition)
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)
end
return Intro