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

Disabling high detail deco and enabling low detail deco with a single click?

Asked by 4 years ago

We are supposed to try and I barely know basic stuff but here's what I came up with. This script obviously destroys HighDetailDeco. How can I make it so that when the button is clicked, HighDetailDeco disappears and LowDetailDeco appears. If clicked again, LowDetailDeco disappears and HighDetailDeco appears. I can do the rest which is changing the text displayed in the button.

h = workspace.HighDetailDeco
a = workspace.LowDetailDeco

function click()
    h:Destroy()
end

script.Parent.MouseButton1Click:Connect(click)
0
you need to make a visible and h invisible FBS_8 25 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

If you're wanting it to return, then destroying it is not the way to go. If I were you, I'd parent it to somewhere such as ReplicatedStorage and reparent it when clicked again.

local h = workspace.HighDetailDeco 
local a = game.ReplicatedStorage.LowDetailDeco --Move lowdetaildeco to replicatedstorage
local Debounce = false

script.Parent.MouseButton1Click:Connect(function()
    if Debounce == false then
        h.Parent = game.ReplicatedStorage
        a.Parent = workspace
        Debounce = true
    else
        a.Parent = game.ReplicatedStorage
        h.Parent = workspace
        Debounce = false
    end
end)
0
OMG THAT'S AWESOME. Thanks! Also thanks for letting me know, I thought if we made them invisible they would still be there causing lag for some users. Thank you! ItsJZaid 45 — 4y
Ad

Answer this question