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)