Skip to content
TheChatArchiveThe Chat Archive
Qwenqwen3-235b-a22b-no-thinking· Alibaba (Qwen)Hugging Face LMArena Human Preference 140K

local ReplicatedStorage = game:GetService("ReplicatedStorage") local humanoid =…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with DeepSeekdeepseek-v3-0324’s answer.
  1. User

    local ReplicatedStorage = game:GetService("ReplicatedStorage") local humanoid = script.Parent local npcModel = humanoid.Parent local returnPoint = game.Workspace:WaitForChild("powrotmng") local PlayerEvent = ReplicatedStorage:WaitForChild("Player") local eventConnected = false while true do script.Parent.Script.Enabled = false

    task.wait()
    if not returnPoint then
    	warn("Return point not found!")
    	break
    end
    humanoid:MoveTo(returnPoint.Position)
    humanoid.MoveToFinished:Wait()
    print("przyszedl")
    PlayerEvent.OnServerEvent:Connect(function(player)
    	print("no ten 1")
    	PlayerEvent:FireClient(player)
    	print("Signal sent to client")
    end)
    eventConnected = true
    

    end

    it need to send that fireclient 1 time only and the same with prints here

  2. Qwen Assistant

    You're on the right track with your script, but there are a few key issues that need to be addressed:

    Issues in your current code:

    1. Infinite Loop Misuse:

      • You're running an infinite loop (while true do), which continuously disables Script, moves the NPC to a position, and connects a new event handler every time.
      • This causes multiple connections of the same event (PlayerEvent.OnServerEvent:Connect(...)), leading to multiple prints and multiple signals being fired.
    2. Connecting Events Inside a Loop:

      • Every loop iteration creates a new connection to PlayerEvent.OnServerEvent, causing multiple triggers when only one is desired.
    3. Unnecessary Disabling of Script:

      • script.Parent.Script.Enabled = false seems redundant unless you have another LocalScript or Script named "Script" that you're trying to disable.

    Goal Clarification:

    From what I understand, you want:

    • The NPC to move to a specific point once.
    • Once it arrives, connect the PlayerEvent once, and fire FireClient(player) only once per player interaction.
    • Print debug messages only once.

    ✅ Corrected Version of Your Script:

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local humanoid = script.Parent
    local npcModel = humanoid.Parent
    local returnPoint = workspace:WaitForChild("powrotmng")
    
    -- References to the event
    local PlayerEvent = ReplicatedStorage:WaitForChild("Player")
    
    -- Make sure we don't connect the event multiple times
    local eventConnected = false
    
    -- Disable any unnecessary scripts if needed
    script.Parent.Script.Enabled = false
    
    -- Move NPC to the return point
    humanoid:MoveTo(returnPoint.Position)
    humanoid.MoveToFinished:Wait()
    print("przyszedl") -- Should print only once
    
    -- Connect the event only once
    if not eventConnected then
    	PlayerEvent.OnServerEvent:Connect(function(player)
    		print("no ten 1")
    		PlayerEvent:FireClient(player)
    		print("Signal sent to client")
    	end)
    	eventConnected = true
    end
    

    ✅ If You Want It to Trigger Only Once Per Player (Optional Enhancement):

    If you want to ensure the event fires only once per player, you can use a table to track who's already been processed:

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local humanoid = script.Parent
    local npcModel = humanoid.Parent
    local returnPoint = workspace:WaitForChild("powrotmng")
    
    local PlayerEvent = ReplicatedStorage:WaitForChild("Player")
    local hasFired = {}
    
    script.Parent.Script.Enabled = false
    
    humanoid:MoveTo(returnPoint.Position)
    humanoid.MoveToFinished:Wait()
    print("przyszedl")
    
    -- Connect event once
    PlayerEvent.OnServerEvent:Connect(function(player)
    	if not hasFired[player] then
    		print("no ten 1")
    		PlayerEvent:FireClient(player, "someData") -- Optional arguments
    		print("Signal sent to client")
    		hasFired[player] = true
    	end
    end)
    

    Summary:

    • Avoid placing event connections inside loops.
    • Use flags like eventConnected or hasFired to ensure actions happen only once.
    • Ensure you're not disabling unrelated scripts unnecessarily.

    Let me know if you also want this behavior for each new round or respawn!

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