Hi!
I am today I made a party system, but when I delete the party, the party only gets deleted for the owner and not the members. And when I try to click leave (from member) it says this error
Serverscript:
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)
Localscript:
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
else
script.Parent.DeleteTeam.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)