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

Touched Event problem?

Asked by
RoyMer 301 Moderation Voter
8 years ago

When the brick containing this script, touches the brick that is named "Stop" it should change the bool value named Anchor to true, I even tried adding a print to check if it is working but the print statement was not printed so I can say that this script is not working.

What I mean: https://imgbomb.com/i/?IlZhv

After doing some tests, I came to the conclusion that this brick is detecting everything else that touches it except the brick named "Stop"...

Also, the brick containing the script is being cframed slowly through the brick named "Stop" and seems like that way it doesn't detect the brick named "Stop", how can I fix this problem?

function Stop(hit)
    print("it is working")
    if hit.Name ==  "Stop" then
    script.Parent.Parent.Settings.Anchor.Value = true
    end
end
script.Parent.Touched:connect(Stop)

2 answers

Log in to vote
0
Answered by 8 years ago

Line 4 is your problem you did:

    script.Parent.Parent.Settings.Anchor.Value = true

You should just do:

    script.Parent.Parent.Settings.Anchor = true

Hope it helps!

Ad
Log in to vote
0
Answered by
duckyo01 120
8 years ago
script.Parent.Touched:connect(function(hit)
if script.Parent:findFirstChild('Stop') then
if hit.Parent.Name == 'Touch' then
script.Parent.Parent.Settings.Anchor.Value  =  true
end
    end
        end)

Try this it may work.

0
Stealing meh answer breh????!?!?@1/1!?11/1/1 xD docrobloxman52 407 — 8y
0
What how? duckyo01 120 — 8y

Answer this question