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

block = script.Parent.Parent["Question Mark Block"]
place = script.Parent.Parent["Place holder block"]
function onTouch(hit) 
    game.ServerStorage["Question Mark Block Deactivate"]:Clone().Parent = block.Parent
    wait(0.1) --here
    script.Parent.Parent["Question Mark Block Deactivate"].Position = place.Position
    place.Parent.Touch.Script:Destroy()
    block:Destroy()
end
script.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.

block = script.Parent.Parent["Question Mark Block"]
place = script.Parent.Parent["Place holder block"]
function onTouch(hit) 
    if hit.Parent:findFirstChild("Humanoid") then
    game.ServerStorage["Question Mark Block Deactivate"]:Clone().Parent = block.Parent
    wait(0.1) --here
    script.Parent.Parent["Question Mark Block Deactivate"].Position = place.Position
    place.Parent.Touch.Script:Destroy()
    block:Destroy()
    end
    end
script.Parent.Touched:connect(onTouch)

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

Ad

Answer this question