I want to add a localscript to a button that makes it dissapear after clicked on it and if the player resets its still not visible
LocalScript=
local player = game.Players.LocalPlayer local leaderboard = player:WaitForChild("leaderstats") local button = script.Parent local price = button:WaitForChild("Price") local item = button:WaitForChild("ItemName") local rs = game:GetService("ReplicatedStorage") button.MouseButton1Click:connect(function() if leaderboard.Money.Value >= price.Value then -- Change "Coins" to your currency name... leaderboard.Money.Value = leaderboard.Money.Value - price.Value local item = rs:WaitForChild(item.Value) item:Clone().Parent = player.StarterGear item:Clone().Parent = player.Backpack button.LocalScript2.Disabled = false end end) while wait() do button.Text = item.Value.." - "..price.Value end
LocalScript2=
script.Parent.Visible = false while true do script.Parent.MouseButton1Click:connect(lol) end local function lol(part) local parent = part.Parent if parent.Humanoid.Health = 0 then script.Parent.Visible = false end end
Can someone fix the localscript
You can set the property of ResetOnSpawn to false. Thats it.