Server-sided script not functioning, no errors

It’s based on a value within leaderstats and it doesn’t seem to work at all. No errors in output but I suspect that the problem has something to do with how I checked the leaderstats value because it functioned perfectly when I used “if Player.Name == “Turned_Away” then” instead.

local player = game:GetService("Players")

game.Players.PlayerAdded:connect(function(Player)
	local HatID = Player:WaitForChild("leaderstats").hiddenstats.HatID -- Path to leaderstats
	if HatID == 0 then
		print("Success!")
	end
end)

If I’m correct, objects inside of leaderstats are xValues and don’t return any type, but instead are just basic objects. Try changing .hiddenstats.HatID to .hiddenstats.HatID.Value

1 Like

Thank you, intvalues have weird properties

1 Like

ValueBase instances store their values within their “Value” properties.

ValueBase is just the base class for IntValue/StringValue/BoolValue instances etc.