I have a script that sends the player through a remote event to a server script but it sends a different player. plr prints the same thing as player.
Script:
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players:FindFirstChild(script.Parent.Text)
print(player.Name)
if player then
game.ReplicatedStorage.Remotes.InvitePlayer:FireServer(plr, player)
end
end)
Will this script work aswell, it uses the variable you removed, do I have to do any changes?
Server Script:
game.ReplicatedStorage.Remotes.InvitePlayer.OnServerEvent:Connect(function(plr, player)
print(player.Name.. 'Person invited to party')
print(plr.Name.. 'Party owner')
local clone = game.ReplicatedStorage.Invited:Clone()
clone.Parent = player.PlayerGui.Party
clone.JoinParty.Text = plr.Name.. ' has invited you to a party'
local image = game:GetService('Players'):GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size48x48)
clone.PlayerImage.Image = image
clone.Timer.Visible = true
clone:SetAttribute('Player', plr.Name)
for i = 1, 45 do
wait(0.04)
local formula = i/50
clone.Timer:TweenSize(UDim2.new(formula, 0, 0.05, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)
end
clone:Destroy()
end)