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

I'm Trying to make a grouped object dissapear on click, but its not working?

Asked by 4 years ago

with a click detector but nothings working, all the scripts out there that i can find are for only a single block? The reason its not working is because its a bunch of parts grouped up but I don't know a script for that so can somebody please help?

0
Could you elaborate a bit? Are you trying to delete them or just make them invisible and not collide with anything? jediplocoon 877 — 4y
0
I'm just trying to make it go invisible for 1 minute then reappear. I'm doing this for a game where you click on something on the ground and it gives you coins but i will do that scripting myself. kollin3456789 4 — 4y
0
is it a model 123nabilben123 499 — 4y
0
Its a model yes kollin3456789 4 — 4y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

There is no Script needed, simply store the ClickDetector Instance as a child of the Model container, and it will activate for all descendants. The same principal applies for listening on to the signal for the Object activation:

local ClickDetector = script.Parent

local function DissolveObject()
    local Model = ClickDetector.Parent:GetChildren()
    for _,Object in pairs(Model) do
        if (Object ~= ClickDetector) then
            Object:Destroy()
        end
    end
end

ClickDetector.MouseClick:Connect(DissolveObject)

If this works for you, don't forget to accept this answer!

0
Thankyou! that worked! kollin3456789 4 — 4y
Ad

Answer this question