:16: attempt to index nil with 'IsVotedQ'

game.ReplicatedStorage.UNanyvotesleftQ.OnServerEvent:Connect(function()
	--for _,v in pairs(game.Players:GetChildren()) do
	--	v.IsVotedQ.VotesLeft.Value = v.IsVotedQ.VotesLeft.Value - 1
	--end
	game.Players.LocalPlayer.IsVotedQ.VotesLeft.Value = game.Players.LocalPlayer.IsVotedQ.VotesLeft.Value - 1

end)

2 comments

0

LocalPlayer can't be accessed from the server. The client (player) that fired the event is included in the parameters. game.ReplicatedStorage.UNanyvotesleftQ.OnServerEvent:Connect(funciton(player)

0

can you please explain what I need to do in order to get it working? im not much of a scripture