I am making something for when a player dies this boolvalue changes to true, it won't work though
function onHumanoidDied(humanoid, player) for _, playerdead in pairs (game.Workspace.PlayerStuffs:FindFirstChild(player.Name)) do playerdead.Value = true end end
Thats the code.
FindFirstChild does not return a table, it returns the first object found matching the string you give it.
Therefore, your loop will not actually run because there is no table for it to iterate through!
You should also just get rid of the humanoid
parameter in your function; you never actually end up having to use it.
You should revise your function to...
function onHumanoidDied(player) local playerDead = workspace.PlayerStuffs:FindFirstChild(player.Name) if playerDead and playerDead:IsA("BoolValue") then -- check if the object exists and is a boolvalue -- if it is, set the object's value to true playerDead.Value = true end end