I’m trying to make some sort of system where there (when activated) is a box around each player in the game apart from the localplayer, when this box is made it’s supposed to be able to be clicked by the localplayer and the name of that player would be put into the localplayer’s gui.
The thing is that when i’m clicking the part that’s on the player(s) character it doesnt print anything or work at all. I need some help with this.
Local Script (For the player doing it):
MainFrame.SelectionButton.MouseButton1Click:Connect(function()
if MainFrame.SelectTxt.Text == "Select" then
MainFrame.SelectTxt.TextColor3 = Color3.fromRGB(255, 175, 62)
MainFrame.SelectTxt.Text = "Selecting"
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= plr.Name then
local partThing = game:GetService("ReplicatedStorage").MCI.Model.MCI:Clone()
partThing.Parent = v.Character
end
end
else
MainFrame.SelectTxt.TextColor3 = Color3.fromRGB(81, 109, 39)
MainFrame.SelectTxt.Text = "Select"
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= plr.Name then
v.Character.MCI:Destroy()
end
end
end
end)
Local Script in the part:
local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui.MciUi
local MainFrame = gui.MainFrame
script.Parent.MouseClick:Connect(function()
local selectingPlayer = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent.Parent)
MainFrame.PlayerName.Text = selectingPlayer.Name
MainFrame.SelectTxt.TextColor3 = Color3.fromRGB(109, 51, 51)
MainFrame.SelectTxt.Text = "Unselect"
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name ~= plr.Name then
v.Character.MCI:Destroy()
end
end
end)
Please help, anything is apreciated.