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

how to make a part fall when you activate a OnTouched Event?

Asked by 5 years ago

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".)

0
Try removing the if function and only include the = false line MArzalAlBuchariZ 33 — 5y
0
Remove the "else" Theroofypidgeot 21 — 5y
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 Theroofypidgeot 21 — 5y

1 answer

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

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

0
also just make one of those infinite corridors TheluaBanana 946 — 5y
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 TheluaBanana 946 — 5y
Ad

Answer this question