Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My TextbuttonDisabler script works but gets Visible after reset?

Asked by 6 years ago

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

1 answer

Log in to vote
0
Answered by 6 years ago

You can set the property of ResetOnSpawn to false. Thats it.

0
oh HALTDEINMAULDUDEN 5 — 6y
0
and wheres the property? HALTDEINMAULDUDEN 5 — 6y
0
Ah its at ScreenGui HALTDEINMAULDUDEN 5 — 6y
0
YAY THANK YOU!! ;DD HALTDEINMAULDUDEN 5 — 6y
Ad

Answer this question