Hello, I’m making a research tree, it appears that it worked, but only the first one, others didnt.
Here’s the script
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local Data = plr:WaitForChild("Data")
local Currency = Data:WaitForChild("Currency")
local ResearchPoints = Currency.ResearchPoints
local Button = script.Parent -- Button
local Successor = Button.Successor -- StringValue, next research
local Researchable = Button.Researchable -- BoolValue, checks if you can research it or not
local Researched = Button.Researched -- BoolValue, checks if it's already researched
Button.MouseButton1Down:Connect(function()
if Researchable.Value == true then
if ResearchPoints.Value >= 50 then
ResearchPoints.Value = ResearchPoints.Value - 50
Researched.Value = true
Button.Parent[Successor.Value].Researchable.Value = true
end
Researchable.Value = false
end
end)