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 5 years ago
local event = game.ReplicatedStorage.Event_Storage.Battle_Player
local event1 = game.ReplicatedStorage.Event_Storage.BP_Client

event.OnServerEvent:Connect(function(player,plr)
    for i,v in pairs(game.Players:GetChildren()) do
        if v.Name == plr.Name then
            local newPlr = game.Players:FindFirstChild(plr.Name)
            warn(newPlr)
            event1:FireClient(player, newPlr)
            warn("Found "..plr.Name)
        end
    end
end)

newPlr nils out

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

1 answer

Log in to vote
0
Answered by 5 years ago
local event = game.ReplicatedStorage.Event_Storage.BP_Client

event.OnClientEvent:Connect(function(player, plr)
warn(plr)
if plr.Name == game.Players.LocalPlayer.Name then
warn("Battle Request Inbound For "..plr.Name)
script.Battle_Inbound.Enabled = true
script.Battle_Inbound.Controls.PlayerName.Text = player.Name
script.Battle_Inbound.Controls.PlayerImage = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name
end
end)

Ad

Answer this question