For example if you were developing a obby game, each stage would be named after the number the stage represents like stage 1 would be named 1. I tried to made a script that would take the stage of the player then find it in the workspace but don't understand what i did wrong in this script that makes error. ERROR:attempt to index upvalue 'f' (a nil value) - line 7
local player = game.Players.LocalPlayer
local ls = player.leaderstats
local Stage = ls.Stage
local f = game.Workspace:FindFirstChild(Stage.Value)
Stage.Changed:connect(function()
f.BrickColor = BrickColor.new("Bright red")
print(Stage.Value)
end)

6 comments
What are you even talking about OBenjOne xD He has it right for the most part.
Can't you see that f was defined? Simply it wasn't found.
Print f real quick before the Brick Color part to see if it still finds nil, print out Stage.Value as well and confirm that it has a counterpart that is named exactly what the value is in the workspace
Oops this is why I comment not answer cause I'm always wrong
This why I never answer cause I don't look close enough
I'm just going to leave this question and try to forget I ever said anything