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

.Touched script won't work anymore for some reason?

Asked by 5 years ago

Hello, I made a script that would active smoke inside a part, but for some reason it won't work anymore. This is a ServerScript.

script.Parent.Touched:Connect(function(Part)
    if script.Parent.HasHit.Value == false then
        script.Parent.HasHit.Value = true
        script.Parent.Anchored = true
        script.Parent.Smoke.Enabled = true
        wait(30)
        script.Parent:Destroy()
    else
        wait()
    end
end)
0
What do you mean by not work anymore? Do you mean it doesnt work in general? jdm4llfem8 94 — 5y
0
Nothing happens in the script. I even tried making it print a string when activated, that doesn't work. TinyScripter 70 — 5y
0
The script isn't disabled, so I don't understand what's going on. TinyScripter 70 — 5y
0
Ensure that your HasHit BooleanValue is set to False. Also, your .Touched event will fire when anything touches it(including parts around the world), so you should make sure that whatevers touching the part is indeed a player.. Thetacah 712 — 5y
0
Any errors in the output? despicablejack2005 83 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I messed about with the script in Studio, when it says

script.Parent.HasHit

it, for some reason, doesn't check for a child but rather a property of the part so what I did to resolve this is changing all of the

script.Parent.HasHit

into

script.Parent:FindFirstChild("HasHit")
Ad

Answer this question