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

Another onTouch problem?

Asked by 9 years ago

Like my last one but i made a place holder brick inside the block

01block = script.Parent.Parent["Question Mark Block"]
02place = script.Parent.Parent["Place holder block"]
03function onTouch(hit)
04    game.ServerStorage["Question Mark Block Deactivate"]:Clone().Parent = block.Parent
05    wait(0.1) --here
06    script.Parent.Parent["Question Mark Block Deactivate"].Position = place.Position
07    place.Parent.Touch.Script:Destroy()
08    block:Destroy()
09end
10script.Parent.Touched:connect(onTouch)

Ive added the path on here. http://prntscr.com/92djsx

And again im not sure why its not working. It works upto the comment "--here"

0
The variable block doesnt delete and the script doesnt destroy and also the block new question mark block doesnt move to the place holder block position LittleBigDeveloper 245 — 9y

1 answer

Log in to vote
1
Answered by
yoshi8080 445 Moderation Voter
9 years ago

Not sure if this would work for you but try this.

01block = script.Parent.Parent["Question Mark Block"]
02place = script.Parent.Parent["Place holder block"]
03function onTouch(hit)
04    if hit.Parent:findFirstChild("Humanoid") then
05    game.ServerStorage["Question Mark Block Deactivate"]:Clone().Parent = block.Parent
06    wait(0.1) --here
07    script.Parent.Parent["Question Mark Block Deactivate"].Position = place.Position
08    place.Parent.Touch.Script:Destroy()
09    block:Destroy()
10    end
11    end
12script.Parent.Touched:connect(onTouch)

I did this quickly and I didn't test it on studio so yea.

Ad

Answer this question