0

I tried to make a System that when you click a button, then the player attribute goes up by 1 but it didn't worked. I dont know how to do this. Any suggestions? Code below:

local localplr = game.Players.LocalPlayer
local char = localplr.Character or localplr.CharacterAdded:Wait()

local df = localplr:GetAttribute("DevilFruit")
local s = localplr:GetAttribute("Strenght")

local dfb = script.Parent.Frame.DevilFruitButton
local sb = script.Parent.Frame.StrenghtButton

while true do
    task.wait(5)
    script.Parent.Frame.Points.Text = "Avaible Points - " .. localplr:GetAttribute("Exp")
    script.Parent.Frame.Strenght.Text = "Strenght - " .. localplr:GetAttribute("Strenght")
    script.Parent.Frame.DevilFruitPoints.Text = "Devil Fruit - " .. localplr:GetAttribute("DevilFruit")
end

dfb.MouseButton1Down:Connect(function()
    if localplr:GetAttribute("Exp") >= 1 then
        localplr:SetAttribute("DevilFruit", df+1)
    end
end)

sb.MouseButton1Down:Connect(function()
    if localplr:GetAttribute("Exp") >= 1 then
        localplr:SetAttribute("Strenght", s+1)
    end
end)
takezo
  • 101
  • 7
  • Does this answer your question? [Trying to add +1 value in a attribute - Roblox Luau](https://stackoverflow.com/questions/73068142/trying-to-add-1-value-in-a-attribute-roblox-luau) – Kylaaa Aug 07 '22 at 01:07
  • Nope, i tried to make a code that if you click the GUI then the Strenght or the Devil Fruit attribute goes up but didn't work – takezo Aug 07 '22 at 13:38

0 Answers0