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

(Solved)Can not I disable a script properly?

Asked by
brok4d 77
5 years ago
Edited 5 years ago

Hi, my problem is that when the floor deactivates the script when it gets on the car it keeps deactivating the script, it does not activate it once and then it is deactivated, because the cohce is touching the ground, what could I do?

local ground = game.Workspace.ground
local car= game.Workspace.car.PrimaryPart

car.Touched:Connect(function(touch)
    if touch then
        script.Parent.fire.Disabled = false
    end
end)

ground.Touched:Connect(function(touch)
    if touch then
        script.Parent.fire.Disabled = true
    end
end)
0
I already tried those methods and they did not work for me, thanks. brok4d 77 — 5y
0
Because other parts of the car are touching it, firing Touched. Add a conditional that checks if touch.Parent ~= car.Parent User#19524 175 — 5y
0
The thing is that when it enters the vehicle it takes possession of the player and touches the ground I have put a print and the debounce works halfway and the check of if ~ = enters without problems. brok4d 77 — 5y

1 answer

Log in to vote
0
Answered by
brok4d 77
5 years ago

I got it, thank you very much everyone.

local car = game.Workspace.car.PrimaryPart
local ground = game.Workspace.ground
local fire = game.Workspace.car.fire.fire

car.Touched:Connect(function(touch)
    if touch then
        if touch.Parent ~= ground then
            fire.Disabled = false
            print("false")

        end

    end
end)
ground.Touched:Connect(function(touch)
    if touch then
        if touch.Parent ~= car.Parent then
            fire.Disabled = true
            print("true")
        end
    end
end)
0
For some strange reason it had worked but stopped working. brok4d 77 — 5y
0
the script works what does not work for me are the particles I do not know what it will be. brok4d 77 — 5y
Ad

Answer this question