I'm trying to give players on a specific team a tool. I have this script

for c = 1, #sciPlrs do
		local sPlayer = sciPlrs[c]
		print(sPlayer)
		local sPlr = game.Players:FindFirstChild(sPlayer)
		print(sPlr)
					game.Players:FindFirstChild(sPlayer.Name).PlayerGui:WaitForChild("SideStuff").Enabled = false	
		sPlayer.CameraMode = "LockFirstPerson"		
		print("Searching")
		--local pCloneBool = sPlr:FindFirstChild("PlayerScripts"):FindFirstChild("PlayerSettings"):FindFirstChild("PotionCloned")
		if --[[pCloneBool.Value == false and --]]  sPlayer:FindFirstChild("Health Potion") == nil then
			print("Object Cloned!")
			local pClone = PotionObject:Clone()
			pClone.Parent = game.Players:FindFirstChild(sPlayer.Name).Backpack
			--pCloneBool.Value = true
		end
		print("Done Searching")
		wait(1)
	end	

Which works fine except for the part where it tries to find the "sPlr" which is the player in the Players tab. When I print the sPlayer value it says the player name but with the sPlr it prints 'nil'. All the variables are fine except sPlr. Any way of finding the player in the Player Tab?

Please Help!

2 comments

0

Is sPlr the local player? If so, why not just use Players.LocalPlayer?

0

This is a server script so I cant use local player...