This is completely out of my depth for this one.
I was having a look at how to make a party system for a game and stumbled upon my video from HowToRoblox.
NOTE I have no idea if this makes a difference however I am trying to send a place under the Game, not a seperate game.
I inserted the model into my game, placed everything in the correct place (from my knowledge) and added my places ID into where it needed to go.
When I test this in game (NOT STUDIO) and press ‘start’, which would teleport me to the game, I get the following error:
The code, which is from the 'PartySystemScript, can be seen below.
local tps = game:GetService("TeleportService")
local placeId = 8648652752
game.ReplicatedStorage.PartySystemRE.OnServerEvent:Connect(function(player, instruction, value1, value2)
if instruction == "kickPlayer" then
if game.ReplicatedStorage.Parties:FindFirstChild(value1) and value2.Parent == game.ReplicatedStorage.Parties[value1].Players then
if game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == player.Name or value2.Value == player.Name then
if game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == value2.Value then
for i, playerInParty in pairs(game.ReplicatedStorage.Parties[value1].Players:GetChildren()) do
game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[playerInParty.Value], false, value1)
end
game.ReplicatedStorage.Parties[value1]:Destroy()
else
game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[value2.Value], false, value1)
value2:Destroy()
end
end
end
elseif instruction == "createParty" then
local partyName = value1 or player.Name .. "'s Party"
partyName = game:GetService("TextService"):FilterStringAsync(partyName, player.UserId)
partyName = partyName:GetNonChatStringForBroadcastAsync()
local newParty = Instance.new("Folder")
newParty.Name = partyName
local players = Instance.new("Folder", newParty)
players.Name = "Players"
local partyLeader = Instance.new("StringValue", players)
partyLeader.Name = "Party Leader"
partyLeader.Value = player.Name
local limit = Instance.new("IntValue", newParty)
limit.Name = "PlayerLimit"
limit.Value = tonumber(value2) or 10
newParty.Parent = game.ReplicatedStorage.Parties
game.ReplicatedStorage.PartySystemRE:FireClient(player, true, partyName)
elseif instruction == "joinParty" then
if game.ReplicatedStorage.Parties:FindFirstChild(value1) and #game.ReplicatedStorage.Parties[value1].Players:GetChildren() < game.ReplicatedStorage.Parties[value1].PlayerLimit.Value then
local playerValue = Instance.new("StringValue")
playerValue.Value = player.Name
playerValue.Parent = game.ReplicatedStorage.Parties[value1].Players
game.ReplicatedStorage.PartySystemRE:FireClient(player, true, value1)
end
elseif instruction == "startParty" then
if game.ReplicatedStorage.Parties:FindFirstChild(value1) and game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == player.Name then
local playersToTP = {}
for i, playerInParty in pairs(game.ReplicatedStorage.Parties[value1].Players:GetChildren()) do
table.insert(playersToTP, game.Players[playerInParty.Value])
end
local tpOptions = Instance.new("TeleportOptions")
tpOptions.ShouldReserveServer = true
tps:TeleportAsync(placeId, playersToTP, tpOptions)
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
for i, d in pairs(game.ReplicatedStorage.Parties:GetDescendants()) do
if d:IsA("StringValue") and d.Value == player.Name then
if d.Name == "Party Leader" then
for i, playerInParty in pairs(d.Parent:GetChildren()) do
game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[playerInParty.Value], false, d.Parent.Parent.Name)
end
d.Parent.Parent:Destroy()
else
game.ReplicatedStorage.PartySystemRE:FireClient(player, false, d.Parent.Parent.Name)
d.Parent.Parent:Destroy()
end
end
end
end)
Please be nice with me, I’m not too good with scripting and this is very outside of my league!