This is my second post today and once again I’m having a pretty frequent problem amongst other people but I find my situation to not be resolved in any other posts
I’m trying to declare the leaderstats folder from the LocalPlayer but I’m getting thrown with an error message, here is my script:
local ts = game:GetService("TweenService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local money = leaderstats:FindFirstChild("Money")
local producer = script.Parent.Parent.producer
local producerChildren = producer:GetChildren()
local button = script.Parent
button.Touched:Connect(function()
local function producerTween()
for i, v in pairs(script.Parent.Parent.producer:GetDescendants()) do
local producerInfo = TweenInfo.new(
0.5, -- time
Enum.EasingStyle.Linear, -- easing style
Enum.EasingDirection.InOut, -- easing direction
0, -- repeat count
false, -- reverses
0 -- delay
)
local producerGoal = {Transparency = 0}
local producerTween = ts:Create(v, producerInfo, producerGoal)
producerTween:Play()
end
end
local buttonInfo = TweenInfo.new(
0.5, -- time
Enum.EasingStyle.Linear, -- easing style
Enum.EasingDirection.InOut, -- easing direction
0, -- repeat count
false, -- reverses
0 -- delay
)
local buttonGoal = {Transparency = 1}
local buttonTween = ts:Create(button, buttonInfo, buttonGoal)
if money <= 100 then
producerTween()
buttonTween:Play()
task.wait(.5)
button.CanTouch = false
else
print("poor")
end
end)
Pretty much everything below the initial declarations are irrelevant (probably) but I threw it in just in case
I’m relatively new to scripting so any feedback and/or support would be much appreciated
Edit: typo smh