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

.Touched script isnt working, im at dead ends!! Any help?

Asked by 7 years ago

So i made this script but it isnt working. please take a look:

script.Parent.Touched:connect(function(hit)

if hit.Parent.Name == "B" then
    print("b touched")
        script.Parent.Parent.Parent.VechicleSeat.MaxSpeed = 0
        end
end)

The part B is touching it because ive seen it. Ive tried it with other stuff but it doesnt work still. I know it isnt working because its not printing anything. Ive also tried hit.Name and it still dont work. Any ideas?

0
Is B a part or a model? superalp1111 662 — 7y
0
It is a part in a model MrTomasboy 13 — 7y
0
What is this script inside of? adark 5487 — 7y
0
A model. It is inside of workspace > a model > another model > and another model MrTomasboy 13 — 7y

2 answers

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

The reason is that you didn't put If hit.Parent:FindFirstChild("Humanoid") then

So Heres the step

1.Put the script into a brick then copy this into script

Part.Touched:connect(function(HIT)
    local H = HIT.Parent:FindFirstChild("Humanoid")
    if H then
        script.Parent.Parent.Parent.VechicleSeat.MaxSpeed = 0
    end
end)

There you go! If this helped then accept the Answer please.

0
Still doesnt work. Im just gonna abandon it and just work it out another way MrTomasboy 13 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Ive given up so im just going to use wait inside the scripts

Thank you to everyone that tried to help :)

Answer this question