Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

(?) HTTP 400 Bad Request Error when Invoking a remote function

Asked by 2 years ago

I'm currently trying to create a party gui for my game. I keep getting this error when I try to start a lobby in the game. (A party gui is a gui that allows you to create groups that get teleported into games together.)

I have script that I'm using that for some reason works in Studio, but not in Roblox.

function Update()
    if game.Players.LocalPlayer:GetAttribute("Party") then
        if workspace.Parties:FindFirstChild( game.Players.LocalPlayer:GetAttribute("Party") ):GetAttribute("Owner") == game.Players.LocalPlayer.Name then
            script.Parent.DeleteTeam.Visible = true
            script.Parent.Start.Visible = true
        else
            script.Parent.DeleteTeam.Visible = false
            script.Parent.Start.Visible = false
        end
        for index,value in pairs(script.Parent.ScrollArea:GetChildren()) do
            if value:IsA("TextLabel") then
                value:Destroy()
            end
        end
        for index,value in pairs(game.Players:GetPlayers()) do
            if value:GetAttribute("Party") == game.Players.LocalPlayer:GetAttribute("Party") then
                local GUI = script.Parent.Parent.GuiUnits.PlayerNameGui:Clone()
                GUI.Text = value.Name
                GUI.Parent = script.Parent.ScrollArea
                GUI.Visible = true
            end
        end
        script.Parent.PartyName.Text = game.Players.LocalPlayer:GetAttribute("Party")
    end
end
game.ReplicatedStorage.PartiesGui.UpdateGui.OnClientEvent:Connect(Update)
script.Parent:GetPropertyChangedSignal("Visible"):Connect(Update)
script.Parent.Invite.MouseButton1Click:Connect(function()
    if script.Parent.PlayerNameInput.Text == "" or script.Parent.PlayerNameInput.Text == " " or script.Parent.PlayerNameInput.Text == nil then
        script.Parent.PlayerNameInput.Visible = true
    else
        game.ReplicatedStorage.PartiesGui.InviteMessageRequest:FireServer(script.Parent.PlayerNameInput.Text)
        script.Parent.PlayerNameInput.Text = ""
        script.Parent.PlayerNameInput.Visible = false
    end
end)--we'll also do a message to invite players to join to the team
script.Parent.Leave.MouseButton1Click:Connect(function()
    if game.Players.LocalPlayer.Name ~= workspace.Parties:FindFirstChild(game.Players.LocalPlayer:GetAttribute("Party")):GetAttribute("Owner") then
        game.ReplicatedStorage.PartiesGui.SetTeam:InvokeServer()
        game.ReplicatedStorage.PartiesGui.RestartGuiLocaly:Fire()
    end
end)
script.Parent.DeleteTeam.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.PartiesGui.DeleteTeam:InvokeServer()
end)
script.Parent.Start.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.PartiesGui.StartGame:InvokeServer() --Here's where the error is.
end)

FYI, the error says: HTTP 400, bad request.

I have checked every item to make sure that anything isn't spelt wrong.

If you need more info, please tell me, thanks!

--SERVERSIDESCRIPT, if you need it.

game.ReplicatedStorage.PartiesGui.SetTeam.OnServerInvoke = function(player,team)
    player:SetAttribute("Party",team)
    game.ReplicatedStorage.PartiesGui.UpdateGui:FireAllClients()
end
game.ReplicatedStorage.PartiesGui.CreateTeam.OnServerInvoke = function(player,name)
    local team = Instance.new("Configuration") 
    team.Name = name
    team:SetAttribute("Owner",player.Name)
    player:SetAttribute("Party",name)
    team.Parent = workspace.Parties
end
game.ReplicatedStorage.PartiesGui.DeleteTeam.OnServerInvoke = function(player)
    workspace.Parties:FindFirstChild(player:GetAttribute("Party")):Destroy()
    for index,value in pairs(game.Players:GetPlayers()) do
        if value:GetAttribute("Party") == player:GetAttribute("Party") then
            value:SetAttribute("Party",nil)
            game.ReplicatedStorage.PartiesGui.RestartGui:FireClient(player)
        end
    end
    game.ReplicatedStorage.PartiesGui.UpdateGui:FireAllClients()
end
game.ReplicatedStorage.PartiesGui.InviteMessageRequest.OnServerEvent:Connect(function(player,send)
    if game.Players:FindFirstChild(send) then
        game.ReplicatedStorage.PartiesGui.InviteMessageRequest:FireClient(game.Players:FindFirstChild(send),player:GetAttribute("Party"))
    else
        game.ReplicatedStorage.PartiesGui.InviteMessageRequest:FireClient(player,"ErrorAtSendingInviteMessage___1__")
    end
end)
game.ReplicatedStorage.PartiesGui.StartGame.OnServerInvoke = function(player)
    local party = player:GetAttribute("Party") 
    local list = {} 
    for index,value in pairs(game.Players:GetPlayers()) do 
        if value:GetAttribute("Party") == party then 
            list[#list+1] = value 
        end 
    end
    local service = game:GetService("TeleportService")
    local playerGui = player:WaitForChild("PlayerGui")
    local game_id = 8231208725
    local reserved_server = service:ReserveServer(game_id)
    service:TeleportToPrivateServer(game_id,reserved_server,list)
end
0
You can't reverse a server to a different game Xapelize 2658 — 2y
0
It is the same game. PolyF1sh 2 — 2y

Answer this question