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

Why is this script not detecting TouchEnded correctly? (solved)

Asked by 10 years ago

This is not all the script but when a button is clicked it spawns a vehicle and a box around it (CanCollide is off). When the vehicle leaves the box, its supposed to remove the box and allow the vehicle to be regenerated. However this does not work and the box remains after the vehicle has left it (Stopped Touching it)

while Workspace:FindFirstChild("RegenSingleBox") do -- Name of box
    wait(1)
    Workspace:FindFirstChild("RegenSingleBox").TouchEnded:connect(function(NoTouch)
        return true
    end) -- If there is nothing touching the box then return true

    if NoTouch() == true then -- if theres nothing touching, destroy the box
        Workspace:FindFirstChild("RegenSingleBox"):Destroy()
        script.Parent.BrickColor = BrickColor.new(1031) 
    end

end

MD

EDIT: Asked on ROBLOX forums and was given a different way of solving the problem.

0
maybe the box is touching the floor? alibix123 175 — 10y

1 answer

Log in to vote
-2
Answered by 10 years ago

I never heard touchended maybe no one uses it.

Ad

Answer this question