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

How to make a part Archivable on touch?

I want to make a part archivable on touch if the name of the person who touched it is named certain. This is what I tried but its not working :P

function OnTouch()
	if script.Parent.Touched.Name == "Player1"
		then script.Parent.Parent.Part.Archivable = true
	end
end

2 comments

0

can you include the full code pls.

0

You don't even have a connect in there duddeeee

1 answer

✓ Accepted answer

I noticed a few things about your code.

First of all, you are not calling your function in any way, which would make it not run.

Second of all, on line 3, you have put your "then" on the wrong line, your "then" has to be on the second line.

Here is some code that should work for you:


This script should go into the "child of the child of the part that is going to be archivable'd"

--Since you are using "script.Parent.Parent.Part.Archivable", that's what I am going to use in this code as well.

script.Parent.Parent.Part.Touched:connect(function(hit)

if not hit.Parent:FindFirstChild("Humanoid") then return end --If the part that touches the part, is actually a player, then we continue

if hit.Parent.Name == "Player1" then

	script.Parent.Parent.Part.Archivable = true

end

end)


However, tell me one thing. Why do you want it to be archivable only after a certain player has touched it?

If this answer helped you, make sure you accept my answer!

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