i need to test out this party system i made from scratch, but i dont have any people to test it out on, so if my scripts contants error, can you notify me about it
server service script
local rep = game.ReplicatedStorage
local value = 0
local module = require(script.LobbySystem)
local tpservice = game:GetService("TeleportService")
rep.Remoteevents.CreateServer.OnServerEvent:Connect(function(plr)
value = value + 1
local folder = Instance.new("Folder")
folder.Name = plr.Name
folder.Parent = rep
local player = Instance.new("StringValue",folder)
player.Value = plr.Name
player.Name = "HostPlayer"
rep.Remoteevents.InputServer:FireAllClients(plr.Name)
end)
rep.Remoteevents.InputPlayer.OnServerEvent:Connect(function(plr, plrname)
local player = rep:FindFirstChild(plrname)
if player then
local value = Instance.new("StringValue",player)
value.Value = plr.Name
value.Name = "Player"
end
end)
rep.Remoteevents.TpAllPlayers.OnServerEvent:Connect(function(plr)
for i,v in pairs(rep:GetChildren()) do
if v:IsA("Folder") and v.Name == plr.Name then
for _, players in pairs(v:GetChildren()) do
if players:IsA("StringValue") then
tpservice:TeleportPartyAsync(112872551410761, players.Value)
end
end
end
end
end)
local script (its in a frame)
local rep = game.ReplicatedStorage
local createbutton = script.Parent.JoinFrame.TextButton
local player = game.Players.LocalPlayer
local amount = 0
createbutton.MouseButton1Down:Connect(function()
rep.Remoteevents.CreateServer:FireServer(player)
script.Parent.JoinFrame.Visible = false
script.Parent.CreateFrame.Visible = true
script.Parent.CreateFrame.HostText.Text = "Host:" .. player.Name
end)
rep.Remoteevents.InputServer.OnClientEvent:Connect(function(plrname)
amount = amount + 1
local severbutton = rep.gui.ServerButton:Clone()
severbutton.Parent = script.Parent.JoinFrame.ScrollingFrame
severbutton.Name = "party" ..amount
severbutton.Text = plrname .. "Party"
severbutton.MouseButton1Down:Connect(function()
rep.Remoteevents.InputPlayer:FireServer(plrname)
script.Parent.JoinFrame.Visible = false
script.Parent.CreateFrame.Visible = true
script.Parent.CreateFrame.HostText.Text = "Host:" .. plrname
local severbutton = rep.gui.PlayerButton:Clone()
severbutton.Parent = script.Parent.CreateFrame.ScrollingFrame
severbutton.Name = player.Name
severbutton.Text = player.Name
end)
end)
script.Parent.CreateFrame.TextButton.MouseButton1Down:Connect(function()
rep.Remoteevents.CreateClose:FireServer()
script.Parent.JoinFrame.Visible = true
script.Parent.CreateFrame.Visible = false
end)
3 Likes
fun fact: you can go into the “test” tab at the top of roblox studio, and start a local server with multiple players all controlled by you. you can start a 2 player local server and get one of the players to join a party to test if it works
2 Likes
problem, im using a crappy computer that would crash if i test
plus i wanna know if theres any way to improve my script
updated the script abit for the tp function
im not sure if this works
rep.Remoteevents.TpAllPlayers.OnServerEvent:Connect(function(plr)
local reserve = tpservice:ReserveServer(112872551410761)
for i,v in pairs(rep:GetChildren()) do
if v:IsA("Folder") and v.Name == plr.Name then
for _, players in pairs(v:GetChildren()) do
if players:IsA("StringValue") then
tpservice:TeleportToPrivateServer(112872551410761, reserve, players.Value)
end
end
end
end
end)
i have encountered a problem while trying to check the script, the problem being that
in this line of code, its only cloning one serverbutton and pasting it in the client side only, is there any way for me to make it so that it can be seen by the host aswell?
There’s no need to loop through and check for name and class, only a :FindFirstChild
then an :IsA
is needed, like so:
rep.Remoteevents.TpAllPlayers.OnServerEvent:Connect(function(plr)
local reserve = tpservice:ReserveServer(112872551410761)
local hostPlr = rep:FindFirstChild(plr.Name) -- haven't read through the script, just assuming this is the host from what i've seen
if not hostPlr then return end -- end script early
if not hostPlr:IsA("Folder") then return end
for _, players in pairs(hostPlr:GetChildren()) do
if players:IsA("StringValue") then
tpservice:TeleportToPrivateServer(112872551410761, reserve, players.Value)
end
end
end)
*not tested, but should work
i think it works since im getting this error 15:45:08.534 HTTP 403 (Forbidden) - Server - Script:27
only problem im currently facing is the local script part
local rep = game.ReplicatedStorage
local createbutton = script.Parent.JoinFrame.TextButton
local player = game.Players.LocalPlayer
local amount = 0
createbutton.MouseButton1Down:Connect(function()
rep.Remoteevents.CreateServer:FireServer(player)
script.Parent.JoinFrame.Visible = false
script.Parent.CreateFrame.Visible = true
script.Parent.CreateFrame.HostText.Text = "Host:" .. player.Name
end)
rep.Remoteevents.InputServer.OnClientEvent:Connect(function(plrname)
amount = amount + 1
local severbutton = rep.gui.ServerButton:Clone()
severbutton.Parent = script.Parent.JoinFrame.ScrollingFrame
severbutton.Name = "party" ..amount
severbutton.Text = plrname .. "Party"
severbutton.MouseButton1Down:Connect(function()
rep.Remoteevents.InputPlayer:FireServer(plrname)
script.Parent.JoinFrame.Visible = false
script.Parent.CreateFrame.Visible = true
script.Parent.CreateFrame.HostText.Text = "Host:" .. plrname
local severbutton = rep.gui.PlayerButton:Clone()
severbutton.Parent = script.Parent.CreateFrame.ScrollingFrame
script.Parent.CreateFrame.TextButton.Visible = false
severbutton.Name = player.Name
severbutton.Text = player.Name
end)
end)
script.Parent.CreateFrame.TextButton.MouseButton1Down:Connect(function()
rep.Remoteevents.TpAllPlayers:FireServer()
script.Parent.JoinFrame.Visible = false
script.Parent.CreateFrame.Visible = false
end)
the local script is only working for the person who presses the server button,. im still confused on how to i make it so that for the players in the party, they can see the players button
i await for response as im still stuck in this mess
i need a dolla dolla dolla is what i need (i need elp)