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

CanCollide and Transparent Button? Part 2

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!

1 comment

0

do you want gui or object?

2 answers

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.

2 comments

0

I am currently at high school when writing this so I am kind of limited to what I can do sorry.

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.

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.

2 comments

0

yeah you cant use a dot followed by [], doesnt work like that

0

dont use work you dont understand

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