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)
fireserver(target) onserverevent(playerthatfiredtheevent, target) -- you dont need plr bc the first parameter on onserverevent is always the player what fired it.
from your script you are saying that 'target' is the person that fired it, 'plr' is the target so when you do fireclient, you are sending yourself nil