Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

0

you need to make a visible and h invisible

1 answer

✓ Accepted answer

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)

1 comment

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.