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

CanCollide and Transparent Button? Part 2

Asked by 3 years ago
Edited 3 years ago

okay hi!

I currently have this script:

local open = false -- a variable to define if its open or not   

script.Parent.MouseClick:Connect(function()
    model = workspace["Model"] -- A model in Workspace (aka Set Piece)

    if open then -- if open or if open == true
        open = false -- we set it to false so it doesn't do the same code

        model.Transparency = 1
        model.CanCollide = false
    else -- you prob get this one lol
        model.Transparency = 0
        model.CanCollide = true
    end 
end)

So like, I am wanting this button to be able to make A a different model go transparent and cancollide false. currently, not working

help!

0
do you want gui or object? xxaxxaz 42 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

What you can do it just change the:

model = workspace["Model"]

to that certain model, for e.g. say you model/rig is called Jack and he is in workspace then you would just do:

model = workspace.Jack

or if your model is inside of another model then, for e.g.

model = workspace.House.Jack

The house is the parent of Jack the model/rig

Hope this was kind of understanding and I hoped it helped.

0
I am currently at high school when writing this so I am kind of limited to what I can do sorry. xxoplol47811t 34 — 3y
0
I can make another video on this but this time with more info to it, but I will have to do this once I'm out of high school. xxoplol47811t 34 — 3y
Ad
Log in to vote
-1
Answered by
xxaxxaz 42
3 years ago

for object: make a object. lets call this object A. put another object into object A. name this new object B. Object B is the button and object A is the object that is vanishing and re apeering. click workspace and turn on filtering enabled from the properties tab. add a click detector in side of the button or object B. put in a local script into StarterGui.

local script:

local A = --rename a to the name of the object you want to vanish and reapeer
local clickdetector = game.Workspace.[A]ClickDetector
clickdetector.MouseClick:Connect(function()
game.Workspace.MyClickDetectorEvent:FireServer()
end)

now add a Remoteevent to workspace. put a local script in this event. rename the remoteevent to MyClickDetectorEvent.

local script:

local A = workspace.part -- rename part to the object you want to reapeer
game.Workspace.MyClickDetectorEvent.OnServerEvent:Connect(function()
    script.Parent.Parent.[A]Transparency = not script.Parent.Parent.[A]Transparency
    script.Parent.Parent.[A]CanCollide = not script.Parent.Parent.[A]CanCollide
end)

I do not take credit for this. this was made from alvinblox.

0
yeah you cant use a dot followed by [], doesnt work like that Gameplayer365247v2 1055 — 3y
0
dont use work you dont understand Gameplayer365247v2 1055 — 3y

Answer this question