Im making a party system that when you invite them they get a pop up.
i wanted to know if this script could work since i currently have no one to test it with.
im new to using remote events and would like to know if the players gui could be made visible from the server itself
local script:
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local InvitePrompt = ReplicatedStorage:WaitForChild("InvitePrompt")
local InviteTo = script.Parent.Text
script.Parent.MouseButton1Click:Connect(function()
InvitePrompt:FireServer(InviteTo)
end)
server script:
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local InvitePrompt = ReplicatedStorage:WaitForChild("InvitePrompt")
InvitePrompt.OnServerEvent:Connect(function(player, InviteTo)
game.Players:FindFirstChild(InviteTo).PlayerGui.Teams.Invited.Visible = true
game.Players:FindFirstChild(InviteTo).PlayerGui.Teams.Invited.TextLabel.Text = (player.Name.. " has invited you to their party")
end)
I mean you also use RemoteEvents as ClientEvents, by sending the event to the client from the server which would be easier since it doesn’t change for everyone on the server (Just optimization kinda)
Yes just like that but with 2 args (InviteTo, player), and in StarterPlayerScripts as a LocalScript you would have something like this.
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local InvitePrompt = ReplicatedStorage:WaitForChild("InvitePrompt")
InvitePrompt.OnClientEvent:Connect(function(player)
game.Players.LocalPlayer.PlayerGui.Teams.Invited.Visible = true
game.Players.LocalPlayer.PlayerGui.Teams.Invited.TextLabel.Text = player.Name .. " has invited you to their party"
end)