I need to make a script that makes a SelectionBox invisible to a specific player, and visible to all the other players. I'm assuming I have to place the selection box in all of the player's cameras. Though I'm not exactly sure on how to go about this.
Here's what I'm using now, when a player enter's it creates a selectionbox places it in the Player's CurrentCamera, and set's the Adornee to The Player's torso. This makes it visible to the local player, and invisible to everyone else. Basically I need to do the opposite. Though I'm having trouble figuring that out.
This is a Local script in the StarterGui
local Player = game.Players.LocalPlayer repeat wait() until Player.Character wait() local box = Instance.new("SelectionBox", game.Workspace.CurrentCamera) box.Color = Player.TeamColor box.Adornee = Player.Character:WaitForChild("Torso") Player.Character.Humanoid.Died:connect(function(Death) game.Workspace.CurrentCamera:FindFirstChild("SelectionBox"):Destroy() end)
Use a Server-Side Script
to do this.
for _,Plyr in pairs(game.Players:GetPlayers()) do if Plyr ~= IGNORED_PLAYER then --Replace IGNORED_PLAYER with the Player that will not see the selection boxes for _,v in pairs(game.Players:GetPlayers()) do if v ~= Plyr then --This prevents Plyr from having a selectionbox local Box = Instance.new("SelectionBox",Plyr.PlayerGui) Box.Color = v.TeamColor --Makes the selectionbox color the same as the teamcolor of the player that the selectionbox is attached to Box.Adornee = v.Character:WaitForChild("Torso") v.Character:WaitForChild("Humanoid").Died:connect(function() Box:Destroy() --Removes the Box if the player that has the selectionbox dies end) end end end end
Hope this helped!