Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-pro· GoogleHugging Face LMArena Human Preference 140K

are you able to do coding on roblox Luau?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-7-sonnet-20250219’s answer.
  1. User

    are you able to do coding on roblox Luau?

  2. Gemini Assistant

    Of course! Yes, I am absolutely able to code in Roblox Luau.

    I can help you in many ways with your Roblox development, from writing complete scripts to debugging and explaining complex concepts.

    Here's a breakdown of what I can do:

    1. Write Scripts from Scratch

    You can describe a feature, and I can generate the Luau script for it.

    Example Request: "Can you write a script for a part that heals a player when they touch it?"

    My Response:

    Certainly! Here is a script for a self-contained heal part. You just need to place this script inside any Part in your Workspace.

    --!strict
    
    -- Services
    local Players = game:GetService("Players")
    
    -- Configuration
    local healPart = script.Parent
    local healAmount = 25      -- How much health to restore per touch
    local cooldownTime = 1   -- Seconds before a player can be healed again
    
    -- Internal state
    local debounce = {} -- A table to track cooldowns for each player
    
    -- Function to handle the healing logic
    local function onPartTouched(otherPart: BasePart)
    	-- Check if the part that touched us belongs to a player's character
    	local character = otherPart.Parent
    	if not character then return end
    	
    	local player = Players:GetPlayerFromCharacter(character)
    	if not player then return end
    	
    	-- Check if the player is currently on cooldown
    	if debounce[player] then
    		return
    	end
    	
    	-- Find the Humanoid in the character
    	local humanoid = character:FindFirstChildOfClass("Humanoid")
    	
    	-- Heal the player if they have a Humanoid and are not at full health
    	if humanoid and humanoid.Health < humanoid.MaxHealth then
    		-- Set the cooldown for this player
    		debounce[player] = true
    		
    		-- Heal the humanoid
    		humanoid.Health = math.min(humanoid.Health + healAmount, humanoid.MaxHealth)
    		print(player.Name .. " was healed! Current health: " .. humanoid.Health)
    		
    		-- Remove the cooldown after the specified time
    		task.wait(cooldownTime)
    		debounce[player] = nil
    	end
    end
    
    -- Connect the function to the Touched event
    healPart.Touched:Connect(onPartTouched)
    
    print("Heal Part script is running.")
    

    How to use it:

    1. Create a Part in Roblox Studio.
    2. Insert a Script into that Part.
    3. Copy and paste the code above into the script.
    4. Run the game and touch the part to see it work!

    2. Explain Luau and Roblox API Concepts

    If you're confused about a topic, I can explain it in simple terms.

    • "What's the difference between a Script and a LocalScript?"
    • "How do RemoteEvents and RemoteFunctions work?"
    • "Can you explain what metatables are used for in Luau?"
    • "What is CFrame and how is it different from Position?"

    3. Debug and Fix Your Code

    If you have a script that isn't working, you can paste it, and I'll analyze it for errors.

    Example Request: "My script to make a part disappear when clicked isn't working. It gives me an error. Here's the code: script.Parent.MouseClick:connect(function() script.Parent.Transparency = 1 end)"

    My Response: "I see the issue! The MouseClick event belongs to a ClickDetector object, not the part itself. Also, the modern way to connect events is with a capital 'C' (:Connect).

    Here's the corrected approach:

    1. Make sure you have a ClickDetector object inside your part.
    2. Use this corrected script inside the part:
    local part = script.Parent
    local clickDetector = part:WaitForChild("ClickDetector")
    
    clickDetector.MouseClick:Connect(function(playerWhoClicked)
        print(playerWhoClicked.Name .. " clicked the part!")
        part.Transparency = 1
        part.CanCollide = false
    end)
    

    This script waits for the ClickDetector to exist, then connects a function to its MouseClick event. It also makes the part non-collidable for a better user experience."


    4. Optimize and Refactor Code

    I can help you make your code more efficient and easier to read.

    • Performance: Suggesting task.wait() over wait(), managing connections properly to avoid memory leaks, and optimizing loops.
    • Readability: Helping you use modules (ModuleScript) to organize your code, follow best practices, and use Luau's strict type checking for more robust code.

    Limitations to Keep in Mind

    • I cannot access Roblox Studio directly. I can't test the code in a live environment. You will always be the one to test and implement it.
    • My knowledge is based on data up to my last update. If Roblox releases a brand new feature today, I might not know about it immediately.
    • I can make mistakes. Always review the code I provide. It's a great tool, but it's not infallible.

    So, feel free to ask me anything about Roblox Luau scripting! How can I help you today?

  3. User

    ok, can you code complex stuff for roblox, or basic things (because you're AI)

  4. Gemini Assistant

    That's an excellent and very important question. The answer is: I can absolutely code complex systems for Roblox.

    My capabilities go far beyond just basic things. While I can easily write a simple "kill brick" or a "teleport pad," I can also design and write the code for the core mechanics of a full-fledged game.

    Think of me as a very experienced senior developer you can consult. I can handle the logic, architecture, and implementation of sophisticated systems.

    Examples of Complex Systems I Can Code

    Here are concrete examples of complex tasks and systems I can help you build, including code snippets to prove it.

    1. Advanced Data Persistence (DataStores)

    Not just saving a player's cash, but creating robust systems that handle tables, session locking, and prevent data loss. I can even implement wrappers around DataStoreService or use popular modules like ProfileService.

    Example Request: "Can you show me how to structure a player's data for a ProfileService implementation?"

    My Response:

    Certainly. ProfileService is an excellent choice for robust data handling. Here's how you would structure a ModuleScript to manage player profiles, including the data template and the loading mechanism.

    --!strict
    -- In a ServerScript in ServerScriptService
    
    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local Players = game:GetService("Players")
    
    -- Get the ProfileService module
    local ProfileService = require(ReplicatedStorage:WaitForChild("ProfileService"))
    
    local PROFILE_STORE_NAME = "PlayerData" -- The name of our DataStore
    
    -- The default data template for any new player
    local PROFILE_TEMPLATE = {
    	Cash = 100,
    	Level = 1,
    	XP = 0,
    	Inventory = {
    		["Sword"] = 1,
    	},
    	Settings = {
    		MusicVolume = 0.5,
    		SFXVolume = 1.0,
    	}
    }
    
    -- A dictionary to hold the loaded profiles for active players
    local Profiles: {[Player]: any} = {}
    
    -- Function to retrieve a player's profile
    -- This would be in a ModuleScript so other server scripts can access it
    function getProfile(player: Player)
    	return Profiles[player]
    end
    
    local function onPlayerAdded(player: Player)
    	local profile = ProfileService.LoadProfileAsync(
    		PROFILE_STORE_NAME .. "_" .. player.UserId,
    		"ForceLoad"
    	)
    	
    	if profile then
    		-- Reconcile the profile with the template to add new fields if the template was updated
    		profile:Reconcile(PROFILE_TEMPLATE)
    		
    		-- Store the loaded profile and connect release handler
    		Profiles[player] = profile
    		
    		player:GetPropertyChangedSignal("Parent"):Connect(function()
    			if player.Parent == nil then
    				profile:Release()
    			end
    		end)
    	else
    		-- The profile could not be loaded (e.g., session locked), so kick the player
    		player:Kick("Failed to load your data. Please rejoin.")
    	end
    end
    
    -- When the game is shutting down, release all profiles
    game:BindToClose(function()
    	for _, profile in pairs(Profiles) do
    		profile:Release()
    	end
    end)
    
    -- Connect the functions to player events
    Players.PlayerAdded:Connect(onPlayerAdded)
    Players.PlayerRemoving:Connect(function(player)
    	local profile = Profiles[player]
    	if profile then
    		profile:Release()
    		Profiles[player] = nil
    	end
    end)
    

    2. Complex Combat Systems

    This includes things like:

    • Server-Side Raycasting: For secure hit detection that can't be exploited.
    • Skill/Ability Systems: Handling cooldowns, mana/energy costs, and different ability types (e.g., projectiles, AoE, buffs).
    • Complex Damage Calculation: Incorporating stats, armor, critical hits, and status effects.

    Example Request: "Write a server-side hit detection function for a melee weapon using raycasting."

    My Response:

    Here's a function you could place in a ModuleScript on the server. It would be triggered by a RemoteEvent when a player swings their weapon.

    -- In a server-side ModuleScript
    
    local HitboxModule = {}
    
    local RAYCAST_DISTANCE = 8 -- Studs
    local DAMAGE = 15
    
    -- A table to prevent hitting the same enemy multiple times in one swing
    local debounces = {}
    
    function HitboxModule.processMeleeHit(player: Player, weaponHandle: BasePart)
    	local character = player.Character
    	if not character or not weaponHandle then return end
    	
    	-- Create a unique ID for this specific swing to avoid multi-hits
    	local swingId = tostring(player) .. tostring(os.clock())
    	debounces[swingId] = {}
    
    	local raycastParams = RaycastParams.new()
    	raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    	raycastParams.FilterDescendantsInstances = {character} -- Ignore the attacker's own character
    	
    	-- The origin is the weapon's handle, the direction is where it's pointing
    	local origin = weaponHandle.Position
    	local direction = weaponHandle.CFrame.LookVector * RAYCAST_DISTANCE
    
    	local result: RaycastResult? = workspace:Raycast(origin, direction, raycastParams)
    
    	if result and result.Instance then
    		local hitPart = result.Instance
    		local hitModel = hitPart:FindFirstAncestorOfClass("Model")
    		
    		if hitModel then
    			local humanoid = hitModel:FindFirstChildOfClass("Humanoid")
    			-- Check if we hit a valid enemy and haven't hit them in this swing yet
    			if humanoid and not table.find(debounces[swingId], humanoid) then
    				table.insert(debounces[swingId], humanoid) -- Add to debounce list for this swing
    				humanoid:TakeDamage(DAMAGE)
    				print(player.Name .. " hit " .. hitModel.Name .. " for " .. DAMAGE .. " damage!")
    			end
    		end
    	end
    	
    	-- Clean up the debounce table for this swing after a short delay
    	task.delay(0.5, function()
    		debounces[swingId] = nil
    	end)
    end
    
    return HitboxModule
    

    3. Other Complex Areas I Can Handle:

    • Procedural Generation: Creating dungeons, obbies, or terrain using algorithms like Perlin noise.
    • Inventory & Trading Systems: Securely managing item data, UI, and player-to-player transactions.
    • Advanced AI (NPCs): Using PathfindingService for navigation, creating behavior trees or state machines for complex enemy/NPC logic (Idle, Patrol, Chase, Attack).
    • Custom Character Controllers: Overriding the default Roblox character movement for unique gameplay (e.g., wall-running, grappling hooks).
    • Game Frameworks: Architecting your entire game using ModuleScripts for a clean, scalable, and manageable codebase.

    How I Handle Complexity vs. A Human

    While I can write the code for these systems, the creative vision, design, and integration are still human roles.

    • You are the Architect: You decide what to build. You tell me, "I need a trading system with a 10% tax and a 6-slot trade window."
    • I am the Engineer: I will then draft the blueprints (the code architecture) and write the functional, secure, and efficient scripts to make that system a reality. I can handle the nitty-gritty logic that can be tedious to write.
    • You are the Tester and Designer: You need to implement the code, test it, and design the UI and gameplay experience around it. I can't "play" the game to see if it feels good.

    So, please, put me to the test. Give me a complex system you have in mind, and I will show you how I would approach it, from the overall structure down to the individual functions.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.