Leaderstats is not a valid memeber of player

  1. What do you want to achieve? the strength going up when the player clicks the screen

  2. What is the issue? it’s giving me an error saying that leaderstats is not a valid memeber of the player but when I check it, it’s there.

    Screen Shot 2021-07-10 at 1.53.33 PM

  3. What solutions have you tried so far? I tried having the script WaitForChild("leaderstats") but that gave me an infinite yield error.

here’s the script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")

local cooldown = 1

ReplicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player)
	
	print("Fired")

	if not RemoteData:FindFirstChild(player.Name) then return "No Folder" end
	
	local debounce = RemoteData[player.Name].debounce
	
	if not debounce.Value then 
		
		print("past debounce if statement")
		
		debounce.Value = true
		
		player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 10 * (player.leadersats.Rebirths.Value + 1)
		
		wait(cooldown)
		
		debounce.Value = false
		
	end
	
end)

(dont mind the prints, I was doing debugging)

put a wait(2) or something in there, i think the script is running before the instance is put into the player

the script is in a tool and get’s activated when its clicked, the instance is there, I just don’t get why it’s not working

oh, its a typo…
look!
lol “leadersats”

oh my god- I think i need to learn grammar before scripting :woman_facepalming:

Oh dang hhahaha, well mark it as a solution lol

1 Like