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

Can anyone help me with this remote event, and invite system?

Asked by
sad_eyez 162
7 years ago
Edited 7 years ago

i am new to remote events, But i am sure they are the only way i can make what i am trying to do, I am trying to make a player invite system to join the in game group, what i need help with is getting these scripts to go to the specified player that the client typed and then i also need to get the clients in game group name to send to the other player, if anyone can help me that would be great.

client to server:

local plr = game.Players.LocalPlayer
local stats = plr:WaitForChild("leaderstats")
local group = stats:WaitForChild("Affiliation")

local request = game:GetService("ReplicatedStorage"):WaitForChild("Request")

local nameofgroup = script.Parent.Parent:WaitForChild("NameGroup")
local otherplayer = script.Parent.Parent:WaitForChild("InvitePlayerName")

script.Parent.MouseButton1Click:connect(function()
    request:FireServer()
end)

server to client:

local request = game:GetService("ReplicatedStorage"):WaitForChild("Request")
local toclient = game:GetService("ReplicatedStorage"):WaitForChild("ToClient")

request.OnServerEvent:Connect(function(plr)
    toclient:FireClient(game.Players[plr.Name])
end)

and the local script to receive the invite:

local toclient = game:GetService("ReplicatedStorage"):WaitForChild("ToClient")
local joingroup = game:GetService("ReplicatedStorage"):WaitForChild("JoinGroup")

toclient.OnClientEvent:Connect(function()
    local clone = joingroup:Clone()
    for i,v in pairs(clone:GetChildren()) do
        if v.Name == "Name" then
            v.Text = "Group "..math.random(1,10)
        end
    end
    clone.Parent = script.Parent
end)

Answer this question