i want to add this request system but it is not working. I am just trying it for player 1 rn.
server script
acceptRequest = game:GetService("ReplicatedStorage"):WaitForChild("acceptRequest")
playerScreen = script.Parent
Players = game:GetService("Players")
player1 = nil
player2 = nil
player3 = nil
player4 = nil
player5 = nil
player6 = nil
player7 = nil
player8 = nil
Players.PlayerAdded:Connect(function(player)
local userId = player.UserId
local thumbnailType = Enum.ThumbnailType.HeadShot
local thumbnailSize = Enum.ThumbnailSize.Size150x150
local content = Players:GetUserThumbnailAsync(userId, thumbnailType, thumbnailSize)
if player1 == nil then
player1 = player
script.Parent.SurfaceGui["player 1"]["player 1 name"].Text = player1.Name
script.Parent.SurfaceGui["player 1"]["player 1 image"].Image = content
script.Parent["player 1 button"].playerIsIngame.Value = true
elseif player2 == nil then
player2 = player
script.Parent.SurfaceGui["player 2"]["player 2 name"].Text = player2.Name
script.Parent.SurfaceGui["player 2"]["player 2 image"].Image = content
script.Parent["player 2 button"].playerIsIngame.Value = true
elseif player3 == nil then
player3 = player
script.Parent.SurfaceGui["player 3"]["player 3 name"].Text = player3.Name
script.Parent.SurfaceGui["player 3"]["player 3 image"].Image = content
script.Parent["player 3 button"].playerIsIngame.Value = true
elseif player4 == nil then
player4 = player
script.Parent.SurfaceGui["player 4"]["player 4 name"].Text = player4.Name
script.Parent.SurfaceGui["player 4"]["player 4 image"].Image = content
script.Parent["player 4 button"].playerIsIngame.Value = true
elseif player5 == nil then
player5 = player
script.Parent.SurfaceGui["player 5"]["player 5 name"].Text = player5.Name
script.Parent.SurfaceGui["player 5"]["player 5 image"].Image = content
script.Parent["player 5 button"].playerIsIngame.Value = true
elseif player6 == nil then
player6 = player
script.Parent.SurfaceGui["player 6"]["player 6 name"].Text = player6.Name
script.Parent.SurfaceGui["player 6"]["player 6 image"].Image = content
script.Parent["player 6 button"].playerIsIngame.Value = true
elseif player7 == nil then
player7 = player
script.Parent.SurfaceGui["player 7"]["player 7 name"].Text = player7.Name
script.Parent.SurfaceGui["player 7"]["player 7 image"].Image = content
script.Parent["player 7 button"].playerIsIngame.Value = true
elseif player8 == nil then
player8 = player
script.Parent.SurfaceGui["player 8"]["player 8 name"].Text = player8.Name
script.Parent.SurfaceGui["player 8"]["player 8 image"].Image = content
script.Parent["player 8 button"].playerIsIngame.Value = true
end
end)
script.Parent["player 1 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 1 button"].playerIsIngame.value then
script.Parent["player 1 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 1 button"].playerIsIngame.value then
script.Parent["player 1 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 2 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 2 button"].playerIsIngame.value then
script.Parent["player 2 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 2 button"].playerIsIngame.value then
script.Parent["player 2 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 3 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 3 button"].playerIsIngame.value then
script.Parent["player 3 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 3 button"].playerIsIngame.value then
script.Parent["player 3 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 4 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 4 button"].playerIsIngame.value then
script.Parent["player 4 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 4 button"].playerIsIngame.value then
script.Parent["player 4 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 5 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 5 button"].playerIsIngame.value then
script.Parent["player 5 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 5 button"].playerIsIngame.value then
script.Parent["player 5 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 6 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 6 button"].playerIsIngame.value then
script.Parent["player 6 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 6 button"].playerIsIngame.value then
script.Parent["player 6 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 7 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 7 button"].playerIsIngame.value then
script.Parent["player 7 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 7 button"].playerIsIngame.value then
script.Parent["player 7 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 8 button"].playerIsIngame.Changed:Connect(function()
if script.Parent["player 8 button"].playerIsIngame.value then
script.Parent["player 8 button"].BrickColor = BrickColor.new("Lime green")
elseif not script.Parent["player 8 button"].playerIsIngame.value then
script.Parent["player 8 button"].BrickColor = BrickColor.new("Really red")
end
end)
script.Parent["player 1 button"].ClickDetector.MouseClick:Connect(function(requestingPlayer)
if script.Parent["player 1 button"].playerIsIngame and not script.Parent["player 1 button"].PlayerHasSoulmate and requestingPlayer.name ~= player1 then
acceptRequest:FireClient(player1,requestingPlayer)
end
end)
local script
game:GetService("ReplicatedStorage"):WaitForChild("acceptRequest").OnClientEvent:Connect(function(requestingPlayer)
script.Parent.TextLabel.text = "you have a soul link request from ".. requestingPlayer.name ..". would you like to accept?"
script.Parent.Visible = true
end)
