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
6 years ago
Edited 6 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?

01local ground = game.Workspace.ground
02local car= game.Workspace.car.PrimaryPart
03 
04car.Touched:Connect(function(touch)
05    if touch then
06        script.Parent.fire.Disabled = false
07    end
08end)
09 
10ground.Touched:Connect(function(touch)
11    if touch then
12        script.Parent.fire.Disabled = true
13    end
14end)
0
I already tried those methods and they did not work for me, thanks. brok4d 77 — 6y
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 — 6y
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 — 6y

1 answer

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

I got it, thank you very much everyone.

01local car = game.Workspace.car.PrimaryPart
02local ground = game.Workspace.ground
03local fire = game.Workspace.car.fire.fire
04 
05car.Touched:Connect(function(touch)
06    if touch then
07        if touch.Parent ~= ground then
08            fire.Disabled = false
09            print("false")
10 
11        end
12 
13    end
14end)
15ground.Touched:Connect(function(touch)
View all 22 lines...
0
For some strange reason it had worked but stopped working. brok4d 77 — 6y
0
the script works what does not work for me are the particles I do not know what it will be. brok4d 77 — 6y
Ad

Answer this question