I'm trying to make a game, where you can invite players to play together (the game has multiple places). When you write someone's name into the textbox, and press an Invite button, if the server contains that player, it appears on your screen, and you can press a Play button, to get on the same server (the TextBox is in the main place, what is a game menu, and you get teleported to an other place, where the real game is).
The explorer looks like this:
StarterGui Invite (ScreenGui) Frame Nam (TextBox) Invite (TextButton) Start (TextButton) Owner (TextLabel, the party owner's name) Party1 (TextLabel) Party2 (TextLabel) Party3 (TextLabel)
LocalScript inside the Invite:
local player = game.Players.LocalPlayer
local inv = script.Parent.Parent.Nam.Text
local invited = game.Players.inv
if invited then
script.Parent.MouseButton1Click:Connect(function()
if invited.PlayerGui.AcceptDeciline.Enabled == false then
invited.PlayerGui.AcceptDeciline.Enabled = true
invited.PlayerGui.AcceptDeciline.Frame.Accept.MouseButton1Click:Connect(function()
invited.PlayerGui.AcceptDeciline.Enabled = true
if script.Parent.Parent.Party1.Text == "" then
script.Parent.Parent.Party1.Text = invited.name
else
if script.Parent.Parent.Party2.Text == "" then
script.Parent.Parent.Party3.Text = invited.Name
else
if script.Parent.Parent.Party3.Text == "" then
script.Parent.Parent.Party3.Text = invited.Name
else
end
end
end
end)
else script.Parent.Parent.Nam.Text = "Already In Party"
end
end)
else
script.parent.Nam.Text = "Player Not Found"
end
LocalScript inside the Play:
local TeleportService = game:GetService("TeleportService")
local sologameID = 3315989953
local duogameID = 3327618291
local triogameID = 3327619773
local squadgameID = 3327620022
local par1 = script.Parent.Parent.Party1.Text
local par2 = script.Parent.Parent.Party2.Text
local par3 = script.Parent.Parent.Party3.Text
local party1 = game.Players.par1
local party2 = game.Players.par2
local party3 = game.Players.par3
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Party1.Text == "" then
wait(0.2)
player.PlayerGui.Menu2.Frame:TweenPosition(UDim2.new(0,0,1,0), "InOut", "Sine",0.5)
wait(0.5)
player.PlayerGui.Menu2.Enabled = false
player.PlayerGui.Teleport.Enabled = true
player.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
TeleportService:Teleport(sologameID, player)
else
if script.Parent.Parent.Party2.Text == "" then
wait(0.2)
player.PlayerGui.Menu2.Frame:TweenPosition(UDim2.new(0,0,1,0), "InOut", "Sine",0.5)
wait(0.5)
player.PlayerGui.Menu2.Enabled = false
player.PlayerGui.Teleport.Enabled = true
party1.PlayerGui.Teleport.Enabled = true
player.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
party1.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
TeleportService:Teleport(duogameID, player,party1,party2,party3)
else
if script.Parent.Parent.Party3.Text == "" then
wait(0.2)
player.PlayerGui.Menu2.Frame:TweenPosition(UDim2.new(0,0,1,0), "InOut", "Sine",0.5)
wait(0.5)
player.PlayerGui.Menu2.Enabled = false
player.PlayerGui.Teleport.Enabled = true
party1.PlayerGui.Teleport.Enabled = true
party2.PlayerGui.Teleport.Enabled = true
player.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
party1.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
party2.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
TeleportService:Teleport(triogameID, player,party1,party2,party3)
else
wait(0.2)
player.PlayerGui.Menu2.Frame:TweenPosition(UDim2.new(0,0,1,0), "InOut", "Sine",0.5)
wait(0.5)
player.PlayerGui.Menu2.Enabled = false
player.PlayerGui.Teleport.Enabled = true
party1.PlayerGui.Teleport.Enabled = true
party2.PlayerGui.Teleport.Enabled = true
party3.PlayerGui.Teleport.Enabled = true
player.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
party1.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
party2.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
party3.PlayerGui.Teleport.Frame:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine",0.5)
TeleportService:Teleport(squadgameID, player,party1,party2,party3)
end
end
end
end)

1 comment
https://www.roblox.com/games/3286873019/Nuntorrett This is the game. When you join and press PLAY you will see an Invite Player button. I want to make that work