Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [lua]

Lua is a powerful, fast, lightweight, embeddable scripting language. Lua is widely used as a scripting language by game programmers, perhaps owing to how easy it is to embed, its fast execution, and its short learning curve.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

How to call a modular script from a parent

I have this line of code to try and retrieve a script from a (distant) parent local signal = require(script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Script) ...
Legacy Coding's user avatar
0 votes
0 answers
23 views

Second purchase button in shop interface doesn't work

The 1st button works, but the 2nd button doesn't work. I think the problem is in this part: ...
Sodz1aX's user avatar
0 votes
0 answers
52 views

In Roblox how can I use :GetTouchingParts() to get all parts a player is currently touching?

I'm trying to make a client-side function where when triggered, it teleports the player to any player that is currently touching a spawn location, but I can't get it working. ...
Oneechan69's user avatar
0 votes
3 answers
90 views

Implementing framerate independent friction with linear deceleration

I'm implementing friction into my game, and I'd like it to be framerate-independent. Here's my first solution, in Lua style pseudo-code: ...
Yolwoocle's user avatar
0 votes
1 answer
35 views

How do I go about Mesh Simplifcation in generating multiple LODs?

I have been recently looking for any information on creating multiple LODs (level of detail) for an inputted mesh. However, there does not appear a lot of articles or pseudo code on how to go about ...
Noah Williams's user avatar
0 votes
1 answer
112 views

How to go about executing lua scripts in a ECS engine?

I'm trying to add scripting with lua to my C++ game engine, and I'm pretty stumped on how to tackle the executing/processing part. I started by creating a ...
Konjointed's user avatar
0 votes
1 answer
45 views

Checking if I am looking through a window using angles

I am developing a mod for a game with a Lua api. I am trying to detect if I am looking through from behind a window when I shoot an enemy. For context, when I shoot through this window I apply a ...
Ben R's user avatar
  • 1
1 vote
0 answers
61 views

Which part of UnLua for UE5 can be defined at runtime?

I'm looking into options to allow a released UE5 game to be modded, with just "text files". That is, without having to use the Unreal Editor, and give access to the game code, to create the ...
Sebastien Diot's user avatar
0 votes
0 answers
19 views

Splitting regions across mountain ranges in 2D tile map partitioning, for a Civ5 mod

I'm trying to do a rewrite of Civ5's AssignStartingPlots.lua (Lua is the scripting language used by Civ5), and I'm comfortable writing it, but conceptually, just ...
Arcaeca's user avatar
  • 101
1 vote
1 answer
109 views

How to properly split damage against armor?

I am developing a third-person shooting style game and I want to implement an armor system. The system that I have envisioned does not reduce the damage to 0, but by half. So the incoming damage is ...
Daniel Rudy's user avatar
0 votes
0 answers
77 views

How do I morph a player's character to a specified player's character?

I'm making a shapeshift command that you can run via chat. It works pretty similar to how HD Admin handles character morphin (https://create.roblox.com/marketplace/asset/13549366436) I know how to get ...
01maxzie's user avatar
0 votes
1 answer
30 views

Why does my Roblox game delete all parts when testing?

I'm working on a Roblox game, but whenever I test it, none of the parts I added in the game display in the Explorer or in the game itself. It works perfectly fine when I view it in the studio, though. ...
Stelbert Stylton's user avatar
0 votes
1 answer
190 views

In my Roblox Tycoon game, my button is not working

I am a rookie at Lua and Roblox Studio in general. I am attempting an easy and reasonably simple tutorial on how to make a pretty good looking tycoon game. In my "Core" script, I am ...
Bubba the Gamer's user avatar
0 votes
1 answer
123 views

Why check the ball and brick collision twice?

I watched https://www.youtube.com/watch?v=F86edI_EF3s. I believe the following code is the complete code https://github.com/games50/breakout/tree/master/breakout13 And https://github.com/games50/...
shingo.nakanishi's user avatar
0 votes
0 answers
48 views

UDim2.new(a, b, c, d) is acting very strangely

I am using a debugger and (i-1)*50 is equal to 50, but ...
ridiche34's user avatar
1 vote
0 answers
67 views

VR Controllers in Roblox Studio not working as expected

I am trying to create a Roblox game with VR support. My understanding is that this code should move the hands of the character as the user moves the controllers: ...
ridiche34's user avatar
0 votes
1 answer
88 views

Why is mission planner not reading my Lua script?

Whenever I try to run my Lua script, right after the first function, be it defining a parameter, mission planner (ground control station of ardupilot), display an error message saying unexpected token....
Abhishek Lohar's user avatar
0 votes
1 answer
638 views

Attempt to call missing method - Lua (Roblox studio)

I am trying to develop a game in Roblox and I have am cannot call a method on a class that I created. I have added my steps below. I am certain the path to the model is correct and I think I have ...
tony09uk's user avatar
  • 153
0 votes
0 answers
101 views

LUA Hooks - Command Modern Operations & PE

Looking for examples of utilizing the available LUA hooks for modding the games Command: Modern Operations and the simulation suit Command: Professional Edition.
Bill's user avatar
  • 1
0 votes
1 answer
60 views

Synchronizing in-game clock vs real world clocks across servers started at different times

Regardless if you know how Roblox works or if you know Lua syntax, I just need an algorithm/equation here. Currently, at the start of each server, I reference the seconds of a centralized clock since ...
Brycki's user avatar
  • 1
0 votes
1 answer
58 views

moving an object around a Circle [closed]

I am going to draw a shape like a gear, how can I move a tooth around a circle? Something like the image below : For example, I need to draw 20 teeth at equal intervals around a circle with a ...
Ashkan Khajeh's user avatar
1 vote
1 answer
93 views

cyclic dependency error in roblox survival game

Description In my game, I have have 3 module files: "PlayerList.lua", "PlayerData.lua" and "WorldData.lua". PlayerList.lua = a list of PlayerData classes (requires ...
saist's user avatar
  • 11
0 votes
0 answers
108 views

What's the most basic way to create and handle multiple objects?

I'm trying to figure out what the most basic approach would be to effectively (or at least more effectively than what I have) create and manage objects. I know I could store them in a table when I ...
Konjointed's user avatar
0 votes
2 answers
239 views

Numbering sprites in a sprite sheet left-to-right, top-to-bottom

I'm using this program called Quadtastic which is a sprite sheet management tool that lets you define quads on a sprite sheet, name them, etc, and export to metadata with those names (+ position, size,...
Garflington's user avatar
  • 1,055
0 votes
2 answers
322 views

How to add a save/load game function to a Lua/C++ game engine

I'm curious what the best approach would be to save the current state of my game. The lua scripts contain the gamestate, but also some gameplay related info that doesn't need to be stored as part of a ...
Oli's user avatar
  • 115
1 vote
1 answer
184 views

How do you clone a part to the Player in Roblox?

I have been making a game in Roblox, But I had one problem. I wanted to make a debug GUI that one can use to spawn items at the Player Location, but I do not really know how to copy it to the player ...
SuspiciouslyBadDev's user avatar
0 votes
1 answer
281 views

Rotating an object in a circular path (using time)

I want to move an object in a circular path but I want it to complete its movement in that circle when the time ends. I tried doing this: ...
Achaibo's user avatar
2 votes
1 answer
137 views

How to deal with rapid acceleration/deceleration from physics forces?

I'm working on a game in LOVE2D using Lua, where you pilot a drilling vehicle. The idea is that as you drill into different surfaces, you speed up/slow down depending on how dense that surface is. I'...
Adam L.'s user avatar
  • 41
0 votes
0 answers
42 views

Applying quadratics to velocity based player movement

In a speed based system where player.x and player.y +=1 when a button is pressed, a 3pt quadratic can be calculated via ...
kite's user avatar
  • 207
2 votes
1 answer
81 views

How do I get the consistent time it would take for two points to reach each other in circular motion?

I'm making a 2D game. It involves the player swinging around a grapple hook in perfect circular motion, however, I want to make the cooldown for this ability based on predicted end position for the ...
Andrew M's user avatar
1 vote
1 answer
150 views

Find the smallest angle to turn between two angles in range 0..1

I have a function for approaching a value to a target by a certain amount: ...
eguneys's user avatar
  • 247
0 votes
1 answer
63 views

for loop problem

So it works first time when the player dies. But when it dies twice the for loop doesn't work. ...
suguma's user avatar
  • 1
0 votes
1 answer
41 views

Drawing rectangle with line's causes join artifact with the graphics api

how can I join lines to draw rectangles, I get this artifact like this, here's my code: ...
eguneys's user avatar
  • 247
0 votes
1 answer
192 views

Using Lua to define NPC behaviour

I'm working on a RPG in C using Lua for event scripting like NPC behavior. I ran into a design problem. I have created Lua threads in the C API for each game object which can be a NPC. So this: ...
Michael Muniko's user avatar
1 vote
0 answers
160 views

How to get started in game development with Lua without LOVE or any game engine [closed]

Recently, I've been wanting to get into Lua, and I just started to. I was wondering if it is possible to make a game, without the LOVE engine, like are there any built-in libraries I can use or ...
Pale_Gray's user avatar
0 votes
1 answer
76 views

How can I allow my players to create, save and use moves?

I want to create a system to allow the players to create, save then use moves in Roblox Studio. My first thought was to do this by letting them create animation files in Roblox Studio, but I'm not ...
ガブリエル Gabriel's user avatar
0 votes
2 answers
142 views

Pathfinder is making my NPC follow my oldest position only

I am trying to make a maze/horror game. I used an online template in the Roblox library as my enemy. I used pathfinder as you will see in the code below. It's finding me like it's supposed to, except ...
Anmol panchal's user avatar
0 votes
1 answer
774 views

Play and Pause State

Problem i want to implement a pause state and with a simple conditional inside the update of PlayState is very very simple. However i think that the pause has to be another state in the StateMachine ...
WhySoBizarreCode's user avatar
2 votes
3 answers
2k views

How to fix diagonal velocity being greater than axis-aligned?

I have a 2D top-down RPG type game, with movement in 8 directions (N/E/S/W/NE/NW/SE/SW) involving both x and y velocity. I'm finding when I'm moving in the diagonal directions, I'm building both x and ...
kite's user avatar
  • 207
0 votes
1 answer
491 views

Rotate relative to set point in a specified direction in a 3D space

I know there's a geometry formula to calculate the next point in rotation relative to another point in 2D but I'm working in 3D and I want to calculate the next position in specified direction as well....
BurntIslanderToast's user avatar
1 vote
0 answers
91 views

Binding Lua Function to Perform tasks using std::async

I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would ...
JJerome's user avatar
  • 11
1 vote
1 answer
500 views

How to connect a GUI button to function?

I am developing a new Roblox game where you can setup and control you're own virtual machine using SurfaceGUIs on a modeled screen. I am trying to make a confirmation GUI where if you click YES, then ...
Aidan Walker's user avatar
1 vote
0 answers
2k views

Optimizing falling sand simulation

So, for the past couple of weeks, I've been working on a falling sand simulation inspired by games such as The Powder Toy, Noita, and Sandspiel. I've been making it in Love2D and I'm please with what ...
Garflington's user avatar
  • 1,055
0 votes
1 answer
158 views

When PlayerRemoving event is fired, for loop does not work properly

while I was implementing the Backback save feature in my Roblox Game (using game.Players.PlayerRemoving:Connect(), I found that when I used a loop of any form (<...
sciencepi's user avatar
0 votes
0 answers
1k views

Hiding World of Warcraft UI Elements with Lua

I'm tyring to make a very simple WoW addon that hides the gryphons on either side of the main menu bar and hides the micro buttons in the lower right. The addon has one Lua script, main.lua: ...
maknel's user avatar
  • 101
0 votes
0 answers
240 views

Integrating Moonsharp with Unity for Nintendo Switch project

Has anyone tried to run Unity project with integrated Moonsharp on Nintendo Switch? Can it be done? Are there any significant performance issues due to running Lua scripts? EDIT: Sorry, I wasn't ...
Przemek Nowaczyk's user avatar
0 votes
0 answers
74 views

Facing issues trying to Parse JSON in Lua

Problem statement: Need help trying to load a JSON file into a table array in Lua for Corona SDK development. My Objective: Call specific data from JSON file to my application by using key value ...
Kinzoku Battu's user avatar
0 votes
1 answer
162 views

How is tile offsetting accomplished in 2d side scrollers?

The idea is to work with tiles that together make up a larger image, or world so to speak. but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw ...
Gabriel Reyes's user avatar
3 votes
1 answer
109 views

How to make the player unable to change some of the game elements?

I am making a text turn based RPG fighting game in which you create your own spells. You also share them as JSON files with your friends. Sharing is required to win. The game is designed so that it ...
Spowmtom's user avatar
0 votes
2 answers
2k views

How to make the character dash forward in Roblox?

In my game, I want to make a skill in a tool to dash forward for a specific range and if the character came in contact with a humanoid during the dash, it stops right on contact and stops the other ...
Adm's user avatar
  • 11

1
2 3 4 5 6