Skip to content
TheChatArchiveThe Chat Archive
o4-mini-2025-04-16· OpenAIHugging Face LMArena Human Preference 140K

ight nothing pops up, ill give you my scripts. Hammer script: -- Services local Players…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Kimikimi-k2-0711-preview’s answer.
  1. User

    ight nothing pops up, ill give you my scripts. Hammer script: -- Services local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService")

    -- Variables local player = Players.LocalPlayer local tool = script.Parent local deleteToolGui = ReplicatedStorage:WaitForChild("DeleteToolGui") local currentTarget = nil local currentGuiInstance = nil local currentHighlight = nil


    -- FORWARD DECLARATIONS (The Fix!) -- We declare the function names first so they can call each other.


    local showHighlight local hideHighlight local showGui local hideGui local onMouseClick


    -- Function Definitions

    hideHighlight = function() if currentHighlight then currentHighlight:Destroy() currentHighlight = nil end end

    hideGui = function() if currentGuiInstance then currentGuiInstance:Destroy() currentGuiInstance = nil end end

    showHighlight = function(model) if not model then return end

    -- Remove existing highlight
    hideHighlight()
    
    -- Create a new highlight for the entire model
    local highlight = Instance.new("Highlight")
    highlight.FillTransparency = 0.7
    highlight.OutlineTransparency = 0.1
    highlight.OutlineColor = Color3.new(1, 0, 0) -- Red
    highlight.Parent = model
    currentHighlight = highlight
    

    end

    showGui = function(character) if not character or not character:FindFirstChild("Torso") then return end

    -- Remove existing GUI
    hideGui()
    
    -- Clone and parent the GUI to the worker's torso
    local guiClone = deleteToolGui:Clone()
    guiClone.Parent = character.Torso
    currentGuiInstance = guiClone
    
    -- Get buttons from the GUI
    local deleteButton = guiClone.Buttons:WaitForChild("DeleteButton")
    local pickupButton = guiClone.Buttons:WaitForChild("PickupButton")
    
    -- Delete Button Logic
    deleteButton.MouseButton1Click:Connect(function()
    	print("🔴 Delete button clicked!") -- Debug print
    	ReplicatedStorage.DeleteWorkerEvent:FireServer(character)
    	hideHighlight()
    	hideGui()
    end)
    
    -- Pickup Button Logic
    pickupButton.MouseButton1Click:Connect(function()
    	print("🟢 Pickup button clicked!") -- Debug print
    	ReplicatedStorage.PickupWorkerEvent:FireServer(character)
    	hideHighlight()
    	hideGui()
    end)
    

    end

    onMouseClick = function() if not tool.Parent or tool.Parent ~= player.Character then return end

    local mouse = player:GetMouse()
    local target = mouse.Target
    local character = target and target:FindFirstAncestorWhichIsA("Model")
    
    -- Check if clicking on a worker model
    if character and character:FindFirstChild("WorkerConfig") then
    	currentTarget = character
    	showHighlight(currentTarget)
    	showGui(currentTarget)
    else
    	-- If we clicked on anything else, hide the GUI and reset the target
    	hideGui()
    	currentTarget = nil
    end
    

    end

    -- Main Loop for Hover Highlighting local function onHeartbeat() if not tool.Parent or tool.Parent ~= player.Character then return end

    -- If a GUI is currently active (we clicked a worker), don't update the hover highlight.
    if currentGuiInstance then return end
    
    local mouse = player:GetMouse()
    local target = mouse.Target
    local character = target and target:FindFirstAncestorWhichIsA("Model")
    
    -- Check if hovering over a worker model
    if character and character:FindFirstChild("WorkerConfig") then
    	-- Only update the highlight if we are hovering over a NEW worker
    	if currentHighlight and currentHighlight.Parent == character then
    		-- Do nothing, already highlighted
    	else
    		showHighlight(character)
    	end
    else
    	hideHighlight()
    end
    

    end

    -- Connections tool.Equipped:Connect(function() UserInputService.InputBegan:Connect(function(input, gameProcessed) -- Check if it's a left click and if the click wasn't already used by a GUI element if input.UserInputType == Enum.UserInputType.MouseButton1 and not gameProcessed then onMouseClick() end end) -- Connect the hover check RunService.Heartbeat:Connect(onHeartbeat) end)

    tool.Unequipped:Connect(function() -- Clean up when tool is put away hideHighlight() hideGui() currentTarget = nil -- Note: We can't easily disconnect anonymous functions from UserInputService/RunService here, -- but the functions themselves check if the tool is equipped (if not tool.Parent...), so it's okay. end) WorkerAction script: -- ServerScriptService > WorkerActionsServer.lua local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local WorkersFolder = ReplicatedStorage:WaitForChild("Workers") -- Your worker templates

    -- RemoteEvents local deleteEvent = ReplicatedStorage:WaitForChild("DeleteWorkerEvent") local pickupEvent = ReplicatedStorage:WaitForChild("PickupWorkerEvent")

    -- Helper: Check if the worker belongs to the player (adjust for your plot system!) local function isPlayerOwner(player, workerModel) local plotName = player:GetAttribute("AssignedPlot") print("📍 Player's plot:", plotName) -- Debug print local plot = workspace.Plots:FindFirstChild(plotName) if not plot then print("❌ Plot not found") -- Debug print return false end local base = plot:FindFirstChild("Base") if not base then print("❌ Base not found in plot") -- Debug print return false end local isOwner = workerModel:IsDescendantOf(base) print("✅ Is worker in base?", isOwner) -- Debug print return isOwner end -- Handle Delete deleteEvent.OnServerEvent:Connect(function(player, workerModel) print("💣 Delete event received from", player.Name) -- Debug print if not workerModel or not workerModel:IsA("Model") then print("❌ Delete: Invalid worker model") return end if not isPlayerOwner(player, workerModel) then print("❌ Delete: Player not owner of", workerModel.Name) return end workerModel:Destroy() print("✅ Deleted:", workerModel.Name) end)

    -- Handle Pickup pickupEvent.OnServerEvent:Connect(function(player, workerModel) -- Validate: Is the worker real? Does the player own it? pickupEvent.OnServerEvent:Connect(function(player, workerModel) print("📦 Pickup event received from", player.Name) -- Debug print if not workerModel or not workerModel:IsA("Model") then print("❌ Pickup: Invalid worker model") return end if not isPlayerOwner(player, workerModel) then print("❌ Pickup: Player not owner of", workerModel.Name) return end -- Tool creation logic... end)

    -- Get the worker template from your WorkersFolder
    local workerName = workerModel.Name
    local workerTemplate = WorkersFolder:FindFirstChild(workerName)
    if not workerTemplate then return end
    
    -- Create a tool (reuse your existing tool-creation logic!)
    local tool = Instance.new("Tool")
    tool.Name = workerName
    tool.RequiresHandle = false
    
    -- Add the worker model to the tool (for placement later)
    local workerClone = workerTemplate:Clone()
    workerClone.Name = "WorkerModel"
    workerClone.Parent = tool
    
    -- Optional: Copy AnimationId (if your workers use it)
    local animId = workerClone:FindFirstChild("AnimationId")
    if animId then
    	animId:Clone().Parent = tool
    end
    
    -- Give the tool to the player's backpack
    tool.Parent = player:WaitForChild("Backpack")
    
    -- Delete the placed worker (since it's now in the inventory)
    workerModel:Destroy()
    print(`{player.Name} picked up {workerName}`)
    

    end)

  2. Assistant

    Alright, let’s tackle this in two parts—first make sure your client is even detecting clicks on a worker, then fix your server so it handles the events properly.


    1) Client: Detecting the Click & Firing the RemoteEvent

    The Problems I See

    1. You’re using UserInputService.InputBegan inside tool.Equipped, but you never disconnect that listener, so it can get messy.
    2. You’re using mouse.Target inside your click handler, but it’s possible the target isn’t in the structure you expect (i.e. doesn’t have a WorkerConfig child).
    3. You never actually check whether your click listener is firing—so let’s add debug prints right at the top of every major callback.

    A Cleaner Client Script

    Put this as a LocalScript inside your Hammer tool:

    -- Services
    local Players       = game:GetService("Players")
    local Replicated    = game:GetService("ReplicatedStorage")
    local RunService    = game:GetService("RunService")
    
    -- Remotes
    local deleteEvent   = Replicated:WaitForChild("DeleteWorkerEvent")
    local pickupEvent   = Replicated:WaitForChild("PickupWorkerEvent")
    
    -- References
    local player        = Players.LocalPlayer
    local tool          = script.Parent
    local guiTemplate   = Replicated:WaitForChild("DeleteToolGui")
    
    -- State
    local hoverConn, clickConn
    local currentModel, currentGui, currentHighlight
    
    -- Utility: highlight an entire model
    local function highlightModel(model)
        if currentHighlight then currentHighlight:Destroy() end
        local h = Instance.new("Highlight")
        h.FillTransparency     = 0.7
        h.OutlineTransparency  = 0.1
        h.OutlineColor         = Color3.new(1,0,0)
        h.Parent               = model
        currentHighlight       = h
    end
    
    local function clearHighlight()
        if currentHighlight then
            currentHighlight:Destroy()
            currentHighlight = nil
        end
    end
    
    local function showWorkerGui(model)
        if currentGui then currentGui:Destroy() end
        currentGui = guiTemplate:Clone()
        -- BillboardGui or SurfaceGui must be used!
        -- Assume DeleteToolGui is a BillboardGui
        currentGui.Parent = model:FindFirstChildWhichIsA("BasePart") or model.PrimaryPart
        local btns = currentGui:WaitForChild("Buttons")
        local del = btns:WaitForChild("DeleteButton")
        local pup = btns:WaitForChild("PickupButton")
    
        del.MouseButton1Click:Connect(function()
            print("🔴 Client: Delete clicked!") 
            deleteEvent:FireServer(model)
            clearHighlight()
            currentGui:Destroy()
            currentGui = nil
        end)
    
        pup.MouseButton1Click:Connect(function()
            print("🟢 Client: Pickup clicked!")
            pickupEvent:FireServer(model)
            clearHighlight()
            currentGui:Destroy()
            currentGui = nil
        end)
    end
    
    local function clearWorkerGui()
        if currentGui then
            currentGui:Destroy()
            currentGui = nil
        end
    end
    
    local function onActivated()
        -- This fires when the tool “uses” (left-click)  
        local mouse = player:GetMouse()
        local targetPart = mouse.Target
        if not targetPart then 
            print("Client: clicked empty space") 
            clearHighlight() 
            clearWorkerGui() 
            currentModel = nil 
            return 
        end
    
        -- Find its Model ancestor
        local model = targetPart:FindFirstAncestorWhichIsA("Model")
        if model and model:FindFirstChild("WorkerConfig") then
            print("Client: clicked worker model", model.Name)
            currentModel = model
            highlightModel(model)
            showWorkerGui(model)
        else
            print("Client: clicked non-worker or invalid model")
            clearHighlight()
            clearWorkerGui()
            currentModel = nil
        end
    end
    
    local function onHeartbeat()
        -- Hover highlight (optional)
        if currentGui then return end  -- don’t override when GUI is open
        local mouse = player:GetMouse()
        local part  = mouse.Target
        local model = part and part:FindFirstAncestorWhichIsA("Model")
        if model and model:FindFirstChild("WorkerConfig") then
            if model ~= currentModel then
                highlightModel(model)
                currentModel = model
            end
        else
            clearHighlight()
            currentModel = nil
        end
    end
    
    -- Equip / Unequip
    tool.Equipped:Connect(function()
        print("Client: Hammer equipped")
        clickConn   = tool.Activated:Connect(onActivated)
        hoverConn   = RunService.Heartbeat:Connect(onHeartbeat)
    end)
    
    tool.Unequipped:Connect(function()
        print("Client: Hammer unequipped")
        if clickConn  then clickConn:Disconnect()  end
        if hoverConn  then hoverConn:Disconnect()  end
        clearHighlight()
        clearWorkerGui()
        currentModel = nil
    end)
    

    Key points:

    • We use tool.Activated to catch left-clicks on the tool.
    • We add prints inside every branch so you can see in the output what’s firing.
    • We assume your DeleteToolGui is a BillboardGui (or SurfaceGui) parented to a part of the worker. If it’s a ScreenGui, it won’t display when attached to a model.

    2) Server: Correct RemoteEvent Handlers

    Your server script had a nested pickupEvent.OnServerEvent—that never fires the outer handler. Let’s clean it up:

    -- ServerScriptService > WorkerActionsServer.lua
    local RS       = game:GetService("ReplicatedStorage")
    local Players  = game:GetService("Players")
    local Workers  = RS:WaitForChild("Workers")
    
    local deleteEv = RS:WaitForChild("DeleteWorkerEvent")
    local pickupEv = RS:WaitForChild("PickupWorkerEvent")
    
    -- Ownership check
    local function isPlayerOwner(player, workerModel)
        local plotName = player:GetAttribute("AssignedPlot")
        print("Server: Player",player.Name,"plot:",plotName)
        local plot = workspace.Plots:FindFirstChild(plotName)
        if not plot then
            warn("Server: Plot not found")
            return false
        end
        local base = plot:FindFirstChild("Base")
        if not base then
            warn("Server: Base not found")
            return false
        end
        local ok = workerModel:IsDescendantOf(base)
        print("Server: Ownership?", ok)
        return ok
    end
    
    -- Delete
    deleteEv.OnServerEvent:Connect(function(player, workerModel)
        print("Server: DeleteEvent from", player.Name)
        if typeof(workerModel) ~= "Instance" or not workerModel:IsA("Model") then
            warn("Server: Bad model") 
            return 
        end
        if not isPlayerOwner(player, workerModel) then
            warn("Server: Not owner, abort delete")
            return
        end
        workerModel:Destroy()
        print("Server: Deleted", workerModel.Name)
    end)
    
    -- Pickup
    pickupEv.OnServerEvent:Connect(function(player, workerModel)
        print("Server: PickupEvent from", player.Name)
        if typeof(workerModel) ~= "Instance" or not workerModel:IsA("Model") then
            warn("Server: Bad model") 
            return 
        end
        if not isPlayerOwner(player, workerModel) then
            warn("Server: Not owner, abort pickup")
            return
        end
    
        -- Create the tool
        local name = workerModel.Name
        local template = Workers:FindFirstChild(name)
        if not template then
            warn("Server: No template for", name)
            return
        end
    
        local tool = Instance.new("Tool")
        tool.Name          = name
        tool.RequiresHandle = false
    
        local clone         = template:Clone()
        clone.Name          = "WorkerModel"
        clone.Parent        = tool
    
        -- Copy AnimationId if present
        local anim = clone:FindFirstChild("AnimationId")
        if anim then anim:Clone().Parent = tool end
    
        tool.Parent = player:WaitForChild("Backpack")
        workerModel:Destroy()
        print("Server: Picked up", name)
    end)
    

    🌟 Testing Checklist

    1. Equip the hammer → you should see Client: Hammer equipped in Output.
    2. Hover a worker → you should see Client: clicked worker model… or hover prints.
    3. Click a worker → you should see 🔴 Client: Delete button clicked! or 🟢 Client: Pickup button clicked! followed by Client: clicked worker model…
    4. Server Output → you should see Server: DeleteEvent from… or Server: PickupEvent from…

    If any of those prints don’t show, trace back:

    • Did you name your RemoteEvents exactly DeleteWorkerEvent / PickupWorkerEvent in ReplicatedStorage?
    • Is your DeleteToolGui a BillboardGui or SurfaceGui so it can actually display on a part?
    • Does your worker model really have a child named WorkerConfig? (Or should you use a CollectionService tag or IsPlaced BoolValue instead?)

    Let me know which print lines light up (or don’t), and we’ll pinpoint the final fix! 🚀

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