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

The newplr is nil when it fires to the client, any ways to fix this?

Asked by 6 years ago
01local event = game.ReplicatedStorage.Event_Storage.Battle_Player
02local event1 = game.ReplicatedStorage.Event_Storage.BP_Client
03 
04event.OnServerEvent:Connect(function(player,plr)
05    for i,v in pairs(game.Players:GetChildren()) do
06        if v.Name == plr.Name then
07            local newPlr = game.Players:FindFirstChild(plr.Name)
08            warn(newPlr)
09            event1:FireClient(player, newPlr)
10            warn("Found "..plr.Name)
11        end
12    end
13end)

newPlr nils out

0
Can you show your LocalScript in the client? popeeyy 493 — 6y
0
ok Odawg566 9 — 6y
0
Here is my local script Odawg566 9 — 6y
0
its in awnser Odawg566 9 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
01local event = game.ReplicatedStorage.Event_Storage.BP_Client
02 
03event.OnClientEvent:Connect(function(player, plr)
04warn(plr)
05if plr.Name == game.Players.LocalPlayer.Name then
06warn("Battle Request Inbound For "..plr.Name)
07script.Battle_Inbound.Enabled = true
08script.Battle_Inbound.Controls.PlayerName.Text = player.Name
09script.Battle_Inbound.Controls.PlayerImage = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name
10end
11end)
Ad

Answer this question