Here is my code currently, sorry if it is messy but I am really getting fed up as I have tried so many different things but the code refuses to acknowledge the Cash value
local config = script.Parent.Config
local Lighting = game:GetService("Lighting")
local Part = Instance.new("Part")
local pointlight = Part:FindFirstChild("PointLight")
script.Parent.Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr:FindFirstChild("leaderstats") and plr:FindFirstChild("Cash") then
local leaderstats = plr:FindFirstChild('leaderstats')
if leaderstats then
if leaderstats.Cash.Value >= config.Cost.Value then
leaderstats.Cash.Value -= config.Cost.Value
if plr.leaderstats.Alpha.Value < 1 then
leaderstats.AlphaBeta.Value = (leaderstats.Beta.Value * 1.2)
leaderstats.Multiplier.Value += (config.Amount.Value * leaderstats.AlphaBeta.Value)
end
if leaderstats.Alpha.Value >= 1 and leaderstats.Beta.Value >= 1 then
leaderstats.AlphaBeta.Value = (leaderstats.Beta.Value * 1.2) * (leaderstats.Alpha.Value * 2.5)
leaderstats.Multiplier.Value += (config.Amount.Value * leaderstats.AlphaBeta.Value)
end
if leaderstats.Alpha.Value < 1 and leaderstats.Beta.Value < 1 then
leaderstats.AlphaBeta.Value = 1
leaderstats.Multiplier.Value = leaderstats.Multiplier.Value + (config.Amount.Value * leaderstats.AlphaBeta.Value)
end
if leaderstats.Beta.Value < 1 then
leaderstats.AlphaBeta.Value = (leaderstats.Alpha.Value * 2.5)
leaderstats.Multiplier.Value += (config.Amount.Value * leaderstats.AlphaBeta.Value)
end
while wait() do
if game.Players.LocalPlayer.leaderstats.Cash.Value < 1000 then
wait(0.1)
Part.Material = Enum.Material.Plastic
pointlight.Enabled = false
elseif game.Players.LocalPlayer.leaderstats.Cash.Value >= 1000 then
wait(0.1)
Part.Material = Enum.Material.Neon
pointlight.Enabled = true
end
end
end
end
end
end
end)
script.Parent.Part.GUI.TextLabel.Text = "L"..config.Cost.Value.." = x"..config.Amount.Value
