How To Fix Elimination Button Applying To Everyone

  1. What do you want to achieve? Keep it simple and clear!

I want to achieve a podium elimination system for a gameshow game I’m making! I want to be able to eliminate a player by simply pressing typing in a contestants’ username and pressing a button.

  1. What is the issue? Include screenshots / videos if possible!

When testing this, instead of eliminating exclusively the player I intended to eliminate - it plays/eliminates everybody with an active podium. The system is managed using module scripts/client scripts and a server script.

Here is what the system is supposed to do (It’s only supposed to fire for the one person I set it to, not both)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried remaking the system about 5 times - this is the first time It’s almost worked fluently.

Server Script:

Players.PlayerAdded:Connect(function(Player)
	local NewPlayer = CheckPlayerID(Player)
	
	Player.CharacterAdded:Connect(function(Character)
		if Player:GetAttribute("Admin") then
			Character.Humanoid.WalkSpeed = 16
			Character.Humanoid.JumpPower = 50
			
		elseif Player:GetAttribute("Player") then
			task.wait(1)

			local AllPodiums = PodiumsFolder:GetChildren()
			local RandomPodium = AllPodiums[math.random(1, #AllPodiums)]
			
			local HumanoidRootPart = Character.HumanoidRootPart
			
			if RandomPodium:GetAttribute("Owner") == nil then	
				local MainPlatform = RandomPodium
				
				MainPlatform:SetAttribute("Taken", true)
				MainPlatform:SetAttribute("Owner", Player.Name)
				MainPlatform.Name = Player.Name
				
				Remotes.Podium.EliminatePlayer.OnServerEvent:Connect(function(Player)
					PodiumModule.Activate(MainPlatform)
				end)
				
				Remotes.Podium.AddPlayer:FireAllClients(Player, MainPlatform)
				HumanoidRootPart.Position = MainPlatform.SpawnPart.Position
				
				RandomPodium = AllPodiums[math.random(1, #AllPodiums)]
			elseif RandomPodium:GetAttribute("Owner") ~= nil then
				warn(RandomPodium, "is taken by", RandomPodium:GetAttribute("Owner"))
			end
		end
	end)
end)

Module Script #1 (Manages the animation for the podium):

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local CollectionService = game:GetService("CollectionService")

local AssetFolder = ReplicatedStorage.Assets
local Remotes = AssetFolder.Remotes
local Sounds = AssetFolder.Sounds

local AdminID = 3835620088 -- 0
local PodiumsFolder = workspace.Podiums

local TI = TweenInfo.new(1.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
local Podium = {}

Podium.Activate = function(Main)
	local PodiumMain = Main

	local function EliminatePart()

		Remotes.Podium.ChangeNeonColor:FireAllClients(Color3.fromRGB(255, 0, 70))
		Sounds.SFX.Podium.Elimination:Play()

		local TrapdoorFolder = PodiumMain.Trapdoor
		local EliminatePart = PodiumMain.EliminatePart
		local SpawnPart = Main.SpawnPart

		local LeftPart = TrapdoorFolder.Left
		local RightPart = TrapdoorFolder.Right

		local LeftOrientTween = TweenService:Create(LeftPart, TI, {Orientation = TrapdoorFolder.LeftModel.Orientation})	
		local LeftPosTween = TweenService:Create(LeftPart, TI, {Position = TrapdoorFolder.LeftModel.Position})

		local RightOrientTween = TweenService:Create(RightPart, TI, {Orientation = TrapdoorFolder.RightModel.Orientation})	
		local RightPosTween = TweenService:Create(RightPart, TI, {Position = TrapdoorFolder.RightModel.Position})	

		task.wait(1.5)

		Sounds.SFX.Podium.TrapdoorOpen:Play()

		LeftOrientTween:Play()
		LeftPosTween:Play()
		RightOrientTween:Play()
		RightPosTween:Play()
	end
	
	EliminatePart()
end

return Podium

Module Script #2 (Manages the other stuff for the podium)

task.wait(2.5)

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer.PlayerGui

local MainUI = PlayerGui.MainUI
local OwnerFrame = MainUI.OwnerFrame

local AssetsFolder = ReplicatedStorage.Assets
local Remotes = AssetsFolder.Remotes

local PodiumsFolder = workspace.Podiums

local Podium = {
	["AllowAutoEliminate"] = false,
}

function Podium.EliminatePlayer(player)
	Remotes.Podium.EliminatePlayer:FireServer(player)
end

function Podium.init(Player, podium)
	Remotes.Podium.ChangeNeonColor.OnClientEvent:Connect(function(color)		
		for i, neon in pairs(podium.Neon.Main:GetChildren()) do
			if neon:IsA("Part") then
				neon.Color = color
			end
		end
	end)

	if Podium.AllowAutoEliminate == true then
		if podium:GetAttribute("Taken") == true then
			if podium:GetAttribute("Owner") == Player.Name then			
				Podium.EliminatePlayer(Player)
			end
		end
	end
end

MainUI.OwnerFrame.EliminatePlayer.Confirm.MouseButton1Click:Connect(function()
	local TextBox = MainUI.OwnerFrame.EliminatePlayer.TextBox.TextBox
	
	Remotes.Podium.EliminatePlayer:FireServer(TextBox.Text)
end)

Client Script #1 (Manages running the module script)

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")

local LocalPlayer = Players.LocalPlayer
local PodiumController = require(script.PodiumController)
local OwnerFrameController = require(script.OwnerFrameController)

OwnerFrameController.init()

ReplicatedStorage.Assets.Remotes.Podium.AddPlayer.OnClientEvent:Connect(function(Player, Podium)	
	PodiumController.init(Player, Podium)
end)

Any help is appreciated!

The issue is in how you’re connecting and handling events in your current setup

Specifically, you’re connecting the elimination event (Remotes.Podium.EliminatePlayer.OnServerEvent) for all players, but you don’t distinguish which player should be affected when the event is fired (and this is what is causing all the players to be affected) This results in all connected podiums reacting to the same event.

Changes I would make:
1. Pass the Target Player’s Name
Modify the Remotes.Podium.EliminatePlayer event to accept the target player’s name and ensure the server-side script eliminates the correct player
2. Handle Podium Ownership Properly
Ensure each podium is associated with its respective player and only affects that player

Updated Scripts

Server Script

Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        if Player:GetAttribute("Player") then
            task.wait(1)

            local AllPodiums = PodiumsFolder:GetChildren()
            local RandomPodium = AllPodiums[math.random(1, #AllPodiums)]
            local HumanoidRootPart = Character.HumanoidRootPart

            if RandomPodium:GetAttribute("Owner") == nil then
                -- Assign the podium to the player
                RandomPodium:SetAttribute("Taken", true)
                RandomPodium:SetAttribute("Owner", Player.Name)
                RandomPodium.Name = Player.Name

                -- Fire the client to display the player on the podium
                Remotes.Podium.AddPlayer:FireAllClients(Player, RandomPodium)

                -- Teleport the player to the podium
                HumanoidRootPart.Position = RandomPodium.SpawnPart.Position
            end
        end
    end)
end)

-- Handle elimination requests
Remotes.Podium.EliminatePlayer.OnServerEvent:Connect(function(Sender, TargetPlayerName)
    local TargetPlayer = Players:FindFirstChild(TargetPlayerName)

    if TargetPlayer then
        -- Find the podium associated with the target player
        for _, Podium in ipairs(PodiumsFolder:GetChildren()) do
            if Podium:GetAttribute("Owner") == TargetPlayer.Name then
                PodiumModule.Activate(Podium)
                break
            end
        end
    end
end)

Module Script #1 (Podium Management)
I just made sure Podium.Activate works properly for the specific podium passed

Client Script (Trigger Elimination)

Update the elimination button logic to send the target player’s name to the server (this should work)

MainUI.OwnerFrame.EliminatePlayer.Confirm.MouseButton1Click:Connect(function()
    local TargetPlayerName = MainUI.OwnerFrame.EliminatePlayer.TextBox.TextBox.Text
    Remotes.Podium.EliminatePlayer:FireServer(TargetPlayerName)
end)

Works perfectly! Thank you so much! Literally saved me hours of frustration. The only thing that I need to tweak is that the red elimination color still updates for all players but I can always change/remove that myself.

I hope your pillow is cold on both sides for the rest of your life and your socks fit perfectly every time you put them on

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.