I have been attempting to move a value (the plr one) through two different RemoteEvents, but it won't work and will come out as nil. Any help?
script.Parent.MouseButton1Click:Connect(function(plr)
local target = script.Parent.Parent.NewTeamPlayerBox.Text
for Index, Player in pairs(game.Players:GetChildren()) do
if Player.Name:lower() == target:lower() then
game.ReplicatedStorage.RemoteEvents.PartyInvite:FireServer(target, plr)
end
end
end)
game.ReplicatedStorage.RemoteEvents.PartyInvite.OnServerEvent:Connect(function(target, plr)
game.ReplicatedStorage.RemoteEvents.PartyInviteTo:FireClient(target,plr)
end)
game.ReplicatedStorage.RemoteEvents.PartyInviteTo.OnClientEvent:Connect(function(target, plr)
script.Parent.Enabled = true
script.Parent.PartyInviteFrame.InviteText.Text = plr.." has invited you to join their party."
script.Parent.PartyInviteFrame.Inviter.Value = plr
end)

1 comment
You could also do the clicking on a server script and fire client without doing fireserver first. (would also prevent exploiters from spamming the text to the player every second)