Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

4 comments

0

Can you show your LocalScript in the client?

0

ok

0

Here is my local script

0

its in awnser

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.