- 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.
- 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)
- 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!