i'm new to scripting and i need a script that will make a block disappear after i touched the block i put the script in. Please use simpler terms since im very new and i dont undertstand everything. Thanks
Heya, let me tell you some simple steps here:
Steps
Insert 3 parts, and name those parts becomes 1, 2 and 3.
Insert an IntValue into the workspace. Also note, don't change the IntValue name.
How do we make these works
If you touched the part '1', then the value will become 1, and then make other parts become invisible.
If you touched the part '2', then the value will become 2, and then make other parts become invisible. And etc.
Script time!
Now it's script time, no more description here, let get right into the scripting time :P
Insert part '1', part '2' and part '3' this script:
script.Parent.Touched:connect(function(hit) -- this will give a event to server if you touched. workspace.Value.Value = script.Parent.Name -- make the IntValue's value become the part's name, so that's why I tell you to change the part name lol end)
Insert the IntValue a script:
while wait(.5) do -- update the script every 0.5 seconds. if script.Parent.Value == 1 then -- if intvalue's value was 1 game.Workspace["1"].Transparency = 0 -- set those part transparency game.Workspace["2"].Transparency = .5 -- if you want to make the part cleary invisible, set it to 1. game.Workspace["3"].Transparency = .5 end if script.Parent.Value == 2 then game.Workspace["1"].Transparency = .5 game.Workspace["2"].Transparency = 0 game.Workspace["3"].Transparency = .5 end if script.Parent.Value == 3 then game.Workspace["1"].Transparency = .5 game.Workspace["2"].Transparency = .5 game.Workspace["3"].Transparency = 0 end end
Ok, it's done. So anyways, comment below if you have a question, or PM me at ROBLOX. Thanks for seeing this answer! c:
Mark this as answer if that worked to you, I have some grammars problem, but it was 100% to work, if that doesn't work, also comment below too :D
Click this to the testing game!
So, I'm Jack_Roblox2008, cya tomorrow :)
the end (also note rip grammar teacher 2020 - 2020)
Well, Jack's answer was right, but it's a little more complicated than I like. Here's how I would do it:
script.Parent.Touched:Connect(function() game.workspace.Part2.Transparency = 1 end
A lot less code and much simpler.