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 fall when you activate a OnTouched Event?

i followed a tutorial and i changed a little bit on the script and i wanted to make a part fall aka unanchored if i touch the part that will let the other part fall. so here is what i did i am very basic

local function OnTouch(hit)
	if hit then
	 else
		game.Workspace.trap.Anchored = false
	end
end

script.Parent.Touched:Connect(OnTouch)

and tell me whats wrong / what i did wrong (i was doing this cause i was inspired by a horror game "Roses".)

3 comments

0

Try removing the if function and only include the = false line

0

Remove the "else"

0

Also make sure the part you want to unanchor is named "trap", and it's in the workspace. Else your script won't work

1 answer

✓ Accepted answer

what u r doing is basically making the part NOT fall when u touched something; that is because u have le

else

in front of the [making part fall] part. In other words u script is something like this(ps its not code):

on part touched; 
	if the part is being touched then do
		[nothing]
	if not, 
	unanchor le part
end function

i hope u can see when is wrong here; u r only gonna make the le part uncanchor when;

one: another thing touches the trigger button

and

two: nothing is touching the trigger button

2 comments

0

also just make one of those infinite corridors

0

like when u enter a corridor and u open a door along the corridor it clones the current corridor and places its start at the door u opened way scarier for 9 yr olds

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