Flahsbang Script
Code Forum » Lua
by Lol
5d ago
Code:Copy to clipboard -- Flashbang function function flashbang(player, enemy) -- Calculate distance between player and enemy local distance = math.sqrt((player.x - enemy.x)^2 + (player.y - enemy.y)^2) -- Adjust flash duration based on distance local flashDuration = 3 - (distance / 10) -- Flash lasts longer if enemy is farther away -- Simulate flash effect enemy:blind(flashDuration) -- 'blind' function temporarily disables enemy's vision -- Other effects (e.g., sound, particle... Read more ..read more
Visit website
Calling a function via local from another file
Code Forum » Lua
by Kostov
2M ago
I have this piece of code in one file: Code:Copy to clipboard if cc_value[4] ~= nil then local function_name = cc_value[4] function_name(db.actor, nil) When the function being called is in the same file, it reads it from local and does what it's supposed to. However, if the function is in another file (example_file.script) and the following code is used… Code:Copy to clipboard if cc_value[4] ~= nil then local function_name = cc_value[4] example_file.function_name(db.actor, nil) … it ignores... Read more ..read more
Visit website
Lua escape sequence
Code Forum » Lua
by ValeryDerugo
5M ago
1 2 print('\065') -- -->A print('\\0' .. 65)-- -->\065 Can anyone explain why in the first case it is an escape sequence but not in the second ..read more
Visit website
How can I make an NPC spawn with a random model each time I spawn it?
Code Forum » Lua
by justvibin035
11M ago
Hi all. Code is below (GLUA). Trying to set up the code so that when an npc spawns in-game, it will spawn with a random model pulled from the innies table each time it is spawned. Right now it spawns with a random model once and each npc iteration after is the same model as the first. What can I tweak so that it will spawn with a random model on each iteration? Code:Copy to clipboard local innies = { "models/ishi/suno/halo_rebirth/npc/innie/male/innie_alfie.mdl"... Read more ..read more
Visit website
Lua for tracking device
Code Forum » Lua
by AaronAaronS
11M ago
Hi all I am completely new to Lua, but I am required to learn it for a project at work regarding asset trackers. Could anyone who knows Lua fluently, please advise if there is sufficient data in the below PDF to suitably control these devices and customise them. https://cdn.lantronix.com/wp-content/uploads/pdf/APP-0117A-using-Lua-scripts-app-note.pdf Also , any tips on the best way to get started with Lua would also be greatly appreciated. Many thanks Aaron ..read more
Visit website
Roblox Door Script only effects one player
Code Forum » Lua
by Gotauia
11M ago
I've been trying to make a door open and close, simple, yet I've only got a week's worth of experience with this coding thing, so I'd like some help. My code works, but it only works for one player, I would like if the code would open the door for all players in the server, could anyone help me with this? here is what I currently have print(game.Players.LocalPlayer) local door = game.Workspace.Door.Door local Player = game.Players.LocalPlayer local NearDoor = false local RunService =... Read more ..read more
Visit website
Your (maybe) first Lua Program
Code Forum » Lua
by Sink
11M ago
Requirements: a lua interpreter sitting tight with you You may be new to lua, so keep in mind: Lua and Luau (Roblox Lua Scripting) may not have the same process. You will learn how to show the text you want in the screen. So, here we go. We can do this by using the power of print() Here's how you will do it: print(text) You probably got the hang of this now, but put quotation's marks in your text "like this" or maybe 'like this, it's your... Read more ..read more
Visit website
How would I go about writing an Interpreter in Lua?
Code Forum » Lua
by Sink
11M ago
Hi, I'm attempting to write an interpreter in Lua, and the first idea was to make it able to run a simple  print function. If anyone is able to answer what's wrong, i would appreciate it. Here is my main code: Code:Copy to clipboard nm = require "numbers" exec = false function readAll(file) local f = assert(io.open(file, "rb")) local content = f:read("*all") f:close() return content end fc = readAll("main.i") for i=1,#fc,1 do if string.find(fc,"prt") and not exec then... Read more ..read more
Visit website
Roblox Lua coding error: "Not a valid member"
Code Forum » Lua
by Flash_DW
11M ago
Does anyone know how to fix this roblox Lua coding error? I keep getting the error message: "Activated is not a valid member of script.". Here's a snapshot of the code: Code:Copy to clipboard local activated = script.Parent.Activated if activated.Value == true then game.Workspace.Dropper1.DropperScript.Activated = true ..read more
Visit website
Lua Embedded how do I terminate a Lua script outside of the interpreter
Code Forum » Lua
by AI Messiah
11M ago
I am working with Embedded Lua So what I want is to be able to report when a host function does something that I think it should not do. I could try to look for an equivalent to the idea of throwing an exception. I also want to have it running in a thread for a game and have another thread terminate the interpreter when the game has to shut down ..read more
Visit website

Follow Code Forum » Lua on FeedSpot

Continue with Google
Continue with Apple
OR