Hello, i have a script where there is a player list a when u click on invite it searches for the player in game.Players by looking for the Text Value or name, when i invite myself it shows on my screen but when i invite someone else i get this error, any help?
Script
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Parent == script.Parent.Parent.Parent then
local PlayerName = script.Parent.Parent.PlayerName.Text
local FindPlayer = game.Players:WaitForChild(PlayerName)
local CloneGui = script.Parent.Parent.Parent.Parent.Parent.Invited:Clone()
CloneGui.Parent = game.Players:WaitForChild(script.Parent.Parent.PlayerName.Text):WaitForChild("PlayerGui").ScreenGui
CloneGui.Position = script.Parent.Parent.Parent.Parent.Parent.AfterCreated.Position
CloneGui.Visible = true
end
end)
If you did not have used RemoteEvents for this, in your end the invited player will not appear, causing another problem.
Also, there’s no need to search for the player if you already created a variable storing it called “FindPlayer”.
could u help me pass through Information? i did this for when a player is invited
local Remote = game:WaitForChild("ReplicatedStorage"):WaitForChild("MatchmakingRemote"):WaitForChild("SendInvite")
script.Parent.MouseButton1Click:Connect(function(Player)
if script.Parent.Parent.Parent == script.Parent.Parent.Parent then
local PlayerName = script.Parent.Parent.PlayerName.Text
local FindPlayer = game.Players:WaitForChild(PlayerName)
Remote:FireServer(Player, PlayerName)
end
end)
and this on the server side
local Remote = game:WaitForChild("ReplicatedStorage"):WaitForChild("MatchmakingRemote"):WaitForChild("SendInvite")
Remote.OnServerEvent:Connect(function(Player, PlayerName)
local CloneGui = game:WaitForChild("ReplicatedStorage"):WaitForChild("MatchmakingRemote"):WaitForChild("Invited")
CloneGui.Parent = game.Players:WaitForChild(PlayerName).PlayerGui.ScreenGui
end)