I tried to make a script on my own kinda but it obviously didnt work. Can someone please tell me what i did wrong? wait(0.5) local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent local function GetLeaderboard( plr, ScoreName ) return plr:WaitForChild("leaderstats"):WaitForChild(ScoreName) end cost = 400 deb = 0
function onClick() wait(0.5) if game.ReplicatedStorage:FindFirstChild(plr.Name.."Element").Value == "Lava" then script.Parent.Text = "You already have this Arc" wait(1) script.Parent.Text = "Lava" else local Points = GetLeaderboard(plr, Points) if Points.Value >= cost then Points.Value = Points.Value - cost if deb == 0 then deb = 1 game.ReplicatedStorage:FindFirstChild(plr.Name.."Element").Value = "Lava" --Alter what stat you would like to increase or decrease after the player has purchased. plr:LoadCharacter() wait(1) deb = 0 end end end end script.Parent.MouseButton1Click:connect(onClick)
