I would like to make a working fire hose that will put out a fire & smoke on a part.
The script seems to not be working, but to me, it seems like it should be.
The script in question:
local touch = false
script.Parent.Touched:connect(function(hit)
print("hit")
if not touch then
touch = true
if hit:FindFirstChild("Smoke") then
if hit.Smoke.Size > 0.2 then
hit.Fire.Size -= 1.5
elseif hit.Smoke.Size < 0.2 then
hit.Smoke:Destroy()
end
elseif hit:FindFirstChild("Fire") then
if hit.Fire.Size > 2 then
hit.Fire.Size -= 1.5
elseif hit.Fire.Size == 2 then
hit.Fire:Destroy()
end
end
script.Parent:Destroy()
end
end)
wait(0.3)
script.Parent.BodyThrust:Destroy()
wait(0.7)
script.Parent:Destroy()
Iām assuming this script is inside a part thatās shot out from the fire hose and propelled forwards by the BodyThrust;
Taking out some of the code reveals how the part goes away immediately when touching anything at all.
Chances are it touches the hose, another bubble or something else, resulting in it being gone before having touched a Flame at all.
|
I tested this with some spheres. Once the ball hits something with either smoke, fire or both it effectively decreases the size of these fire/smoke effects before vanishing.
local thing = script.Parent
local hasHit = false
thing.Touched:Connect(function(hit)
local fire = hit:FindFirstChild("Fire")
local smoke = hit:FindFirstChild("Smoke")
if fire or smoke then hasHit = true end
if fire then
if fire.Size > 2 then
fire.Size -= 1.5
else
fire:Destroy()
end
end
if smoke then
if smoke.Size > 0.2 then
smoke.Size -= 1.5
else
smoke:Destroy()
end
end
if hasHit then thing:Destroy() end
end)
wait(0.5)
thing.BodyThrust:Destroy()
wait(1)
thing:Destroy()
So I tried the script out and it doesnāt seem to work, as if it didnāt find the smoke or fire.
Although the part is being destroyed, the fire doesnāt go out.
local thing = script.Parent
local hasHit = false
thing.Touched:Connect(function(hit)
print("hit")
local fire = hit:FindFirstChild("Fire")
local smoke = hit:FindFirstChild("Smoke")
if fire or smoke then hasHit = true end
if fire then
print("fire")
if fire.Size > 2 then
fire.Size -= 1.5
else
fire:Destroy()
end
end
if smoke then
print("smoke")
if smoke.Size > 0.2 then
smoke.Size -= 1.5
else
smoke:Destroy()
end
end
if hasHit then thing:Destroy() end
end)
wait(0.5)
thing.BodyThrust:Destroy()
wait(1)
thing:Destroy()
The only thing I added was the print statements.
Loved the visual analogy though
: D
As far as I know, the script should work so Iām stumped on why it doesnāt. Would it be better to have a script inside the part that is one fire?
Does it print āfireā or āsmokeā for you? Or what do the fire/smoke parts look like?
Is it ever possible that the āCanTouchā property is somehow set to false for them?
Iāve just checked and CanTouch is true, and it does print āhitā but not āfireā or āsmokeā
The output:
21:03:41.799 :: Adonis :: Loading... - Server
21:03:41.800 :: Adonis :: Requiring Adonis MainModule; Model URL: https://www.roblox.com/library/7510592873 - Studio
21:03:41.800 Requiring asset 7510592873.
Callstack:
ServerScriptService.Adonis_Loader.Loader.Loader, line 164
- Studio
21:03:42.080 The RunContext of LocalScript is fixed to Legacy and cannot be changed. New value will be ignored. - Studio
21:03:42.448 Requiring asset 512742721.
Callstack:
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 29
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 28
- Server
21:03:42.477 Requiring asset 1638103268.
Callstack:
cloud_5027226818.PipePlugin, line 25
cloud_5027226818.PipePlugin, line 24
- Server
21:03:42.557 DataStoreService: StudioAccessToApisNotAllowed: Cannot write to DataStore from studio if API access is not enabled. API: SetAsync, Data Store: __TEST - Studio
21:03:42.559 :: Adonis :: Using MockDataStoreService instead of DataStoreService - Studio
21:03:42.615 Requiring asset 518094091.
Callstack:
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 30
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 28
- Server
21:03:42.714 :: Adonis :: Requiring Alerts Module by ID; Expand for module URL > ā¶ {...} - Server
21:03:42.714 Requiring asset 8096250407.
Callstack:
required_asset_7510592873.MainModule.Server.Server, line 394 - require
required_asset_7510592873.MainModule.Server.Plugins.Urgent_Messages, line 17
- Server
21:03:47.468 EnglishGeneratorStart is not a valid member of Workspace "Workspace" - Server - Script:7
21:03:47.468 Stack Begin - Studio
21:03:47.468 Script 'ServerScriptService.Script', Line 7 - Studio - Script:7
21:03:47.468 Stack End - Studio
21:03:48.443 Infinite yield possible on 'Players.lenovo17101:WaitForChild("menu")' - Studio
21:03:48.444 Stack Begin - Studio
21:03:48.444 Script 'Players.lenovo17101.PlayerGui.MainMenu&LoadingScreen.MainMenu.PlayButton.LocalScript', Line 14 - Studio - LocalScript:14
21:03:48.444 Stack End - Studio
21:03:54.240 hit - Server - WaterScript:33
21:03:54.240 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.240 hit - Server - WaterScript:33
21:03:54.240 hit - Server - WaterScript:33
21:03:54.241 hit - Server - WaterScript:33
21:03:54.241 hit - Server - WaterScript:33
21:03:54.241 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.342 hit - Server - WaterScript:33
21:03:54.343 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.343 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.344 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.345 hit - Server - WaterScript:33
21:03:54.346 hit - Server - WaterScript:33
21:03:54.346 hit - Server - WaterScript:33
21:03:54.444 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.445 hit - Server - WaterScript:33
21:03:54.445 hit - Server - WaterScript:33
21:03:54.445 hit - Server - WaterScript:33
21:03:54.445 hit - Server - WaterScript:33
21:03:54.445 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.446 hit - Server - WaterScript:33
21:03:54.446 hit - Server - WaterScript:33
21:03:54.446 hit - Server - WaterScript:33
21:03:54.446 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.548 hit - Server - WaterScript:33
21:03:54.548 ā¶ hit (x2) - Server - WaterScript:33
21:03:54.548 hit - Server - WaterScript:33
21:03:54.549 hit - Server - WaterScript:33
21:03:54.549 hit - Server - WaterScript:33
21:03:54.549 hit - Server - WaterScript:33
21:03:54.549 hit - Server - WaterScript:33
21:03:54.652 ā¶ hit (x5) - Server - WaterScript:33
21:03:55.266 hit - Server - WaterScript:33
21:03:55.266 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.266 hit - Server - WaterScript:33
21:03:55.266 hit - Server - WaterScript:33
21:03:55.266 hit - Server - WaterScript:33
21:03:55.266 hit - Server - WaterScript:33
21:03:55.266 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.267 hit - Server - WaterScript:33
21:03:55.267 hit - Server - WaterScript:33
21:03:55.267 hit - Server - WaterScript:33
21:03:55.370 :: Adonis :: Loading Version: 260 Complete; Required by Loader version: 260 - Server
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 hit - Server - WaterScript:33
21:03:55.381 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.382 hit - Server - WaterScript:33
21:03:55.382 hit - Server - WaterScript:33
21:03:55.382 hit - Server - WaterScript:33
21:03:55.382 hit - Server - WaterScript:33
21:03:55.382 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.382 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.383 hit - Server - WaterScript:33
21:03:55.383 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.383 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.384 hit - Server - WaterScript:33
21:03:55.384 hit - Server - WaterScript:33
21:03:55.384 hit - Server - WaterScript:33
21:03:55.384 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.384 hit - Server - WaterScript:33
21:03:55.384 hit - Server - WaterScript:33
21:03:55.384 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.385 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.386 hit - Server - WaterScript:33
21:03:55.387 hit - Server - WaterScript:33
21:03:55.469 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.573 hit - Server - WaterScript:33
21:03:55.573 hit - Server - WaterScript:33
21:03:55.574 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.574 ā¶ hit (x2) - Server - WaterScript:33
21:03:55.574 hit - Server - WaterScript:33
21:03:55.574 hit - Server - WaterScript:33
21:03:55.574 hit - Server - WaterScript:33
21:03:55.574 ā¶ hit (x3) - Server - WaterScript:33
21:03:55.677 hit - Server - WaterScript:33
Thatās a lot of hits. Can you also try and print hit.Name (the name of the part thatās being hit)
Maybe with the Explorer open whilst testing in Studio you can also confirm whether it should hit the fire/smoke part or not.
Obviously canāt look at what the exact place looks like, but perhaps even ātagā the parts hit with a colour. Where hit.BrickColor = BrickColor.new("Really red") which may help visualising what parts are being hit instead
I tried adding the colour thing and it also didnāt work. It seems like the part isnāt even hitting the part with fire in it.
local thing = script.Parent
local hasHit = false
thing.Touched:Connect(function(hit)
print("hit")
local fire = hit:FindFirstChild("Fire")
local smoke = hit:FindFirstChild("Smoke")
if fire or smoke then hasHit = true end
hit.BrickColor = BrickColor.new("Really red")
if fire then
print("fire")
if fire.Size > 2 then
fire.Size -= 1.5
else
fire:Destroy()
end
end
if smoke then
print("smoke")
if smoke.Size > 0.2 then
smoke.Size -= 1.5
else
smoke:Destroy()
end
end
if hasHit then thing:Destroy() end
end)
wait(0.5)
thing.BodyThrust:Destroy()
wait(1)
thing:Destroy()
But after making the parts non-transparent, I can see that they donāt actually move from the fire hose. Although, even after walking up to the wall with fire and actually hitting it with the fire hose, it still didnāt go out.
Ye clever to make the parts non-transparent. Maybe if the spawnposition of these parts is slightly further from the hose it wonāt make contact with that? Then a higher BodyThrust might help getting them to the āend of the particleā (see yellow drawing)
Not quite sure how :x
Youād expect the part to stay active until itās hit a fire/smoke part or ran out.
Maybe temporarily removing the if fire or smoke then hasHit = true end line does something or adding a print(hit.Name) helps tell what part was hit
I put the hit.Name in and the result is the following:
Output:
18:01:02.041 hit - Server - WaterScript:33
18:01:02.041 Hose1 - Server - WaterScript:38
18:01:02.243 hit - Server - WaterScript:33
18:01:02.243 Union - Server - WaterScript:38
18:01:02.243 hit - Server - WaterScript:33
18:01:02.243 RightUpperArm - Server - WaterScript:38
18:01:02.243 hit - Server - WaterScript:33
18:01:02.244 RightHand - Server - WaterScript:38
18:01:02.244 hit - Server - WaterScript:33
18:01:02.244 Nozzle - Server - WaterScript:38
18:01:02.244 hit - Server - WaterScript:33
18:01:02.244 Nozzle - Server - WaterScript:38
18:01:02.244 hit - Server - WaterScript:33
18:01:02.244 Hose1 - Server - WaterScript:38
18:01:02.244 hit - Server - WaterScript:33
18:01:02.244 RightLowerArm - Server - WaterScript:38
I also made the part spawn a little further away from the nozzle.
After another run the output is the following:
18:03:25.676 hit - Server - WaterScript:33
18:03:25.676 Nozzle - Server - WaterScript:38
18:03:25.676 hit - Server - WaterScript:33
18:03:25.676 Nozzle - Server - WaterScript:38
18:03:25.676 hit - Server - WaterScript:33
18:03:25.676 Nozzle - Server - WaterScript:38
18:03:25.676 hit - Server - WaterScript:33
18:03:25.676 Nozzle - Server - WaterScript:38
18:03:25.676 hit - Server - WaterScript:33
18:03:25.677 Nozzle - Server - WaterScript:38
18:03:25.677 hit - Server - WaterScript:33
18:03:25.677 Nozzle - Server - WaterScript:38
18:03:25.677 hit - Server - WaterScript:33
18:03:25.677 Union - Server - WaterScript:38
18:03:25.677 hit - Server - WaterScript:33
18:03:25.678 Nozzle - Server - WaterScript:38
18:03:25.678 hit - Server - WaterScript:33
18:03:25.678 Nozzle - Server - WaterScript:38
18:03:25.678 hit - Server - WaterScript:33
18:03:25.678 Union - Server - WaterScript:38
18:03:25.777 hit - Server - WaterScript:33
18:03:25.777 Hose1 - Server - WaterScript:38
18:03:25.777 hit - Server - WaterScript:33
18:03:25.778 Union - Server - WaterScript:38
18:03:25.778 hit - Server - WaterScript:33
18:03:25.778 Hose1 - Server - WaterScript:38
18:03:25.778 hit - Server - WaterScript:33
18:03:25.778 Union - Server - WaterScript:38
18:03:25.778 hit - Server - WaterScript:33
18:03:25.778 Union - Server - WaterScript:38
18:03:25.778 hit - Server - WaterScript:33
18:03:25.779 Union - Server - WaterScript:38
18:03:25.779 hit - Server - WaterScript:33
18:03:25.779 Union - Server - WaterScript:38
18:03:25.779 hit - Server - WaterScript:33
18:03:25.779 Hose1 - Server - WaterScript:38
18:03:25.882 hit - Server - WaterScript:33
18:03:25.882 Hose1 - Server - WaterScript:38
18:03:27.932 hit - Server - WaterScript:33
18:03:27.932 Hose1 - Server - WaterScript:38
18:03:28.031 hit - Server - WaterScript:33
18:03:28.031 LeftUpperLeg - Server - WaterScript:38
18:03:28.031 hit - Server - WaterScript:33
18:03:28.031 LeftLowerLeg - Server - WaterScript:38
18:03:28.135 hit - Server - WaterScript:33
18:03:28.135 RightUpperLeg - Server - WaterScript:38
18:03:28.135 hit - Server - WaterScript:33
18:03:28.136 LowerTorso - Server - WaterScript:38
18:03:28.136 hit - Server - WaterScript:33
18:03:28.136 RightFoot - Server - WaterScript:38
18:03:28.136 hit - Server - WaterScript:33
18:03:28.136 RightLowerLeg - Server - WaterScript:38
18:03:28.136 hit - Server - WaterScript:33
18:03:28.136 HumanoidRootPart - Server - WaterScript:38
18:03:28.136 hit - Server - WaterScript:33
18:03:28.136 LeftLowerLeg - Server - WaterScript:38
18:03:28.137 hit - Server - WaterScript:33
18:03:28.137 UpperTorso - Server - WaterScript:38
18:03:28.199 hit - Server - WaterScript:33
18:03:28.199 Part1 - Server - WaterScript:38
18:03:28.214 hit - Server - WaterScript:33
18:03:28.214 LeftFoot - Server - WaterScript:38
18:03:28.281 hit - Server - WaterScript:33
18:03:28.281 Part1 - Server - WaterScript:38
18:03:28.331 hit - Server - WaterScript:33
18:03:28.331 Union - Server - WaterScript:38
18:03:28.331 hit - Server - WaterScript:33
18:03:28.331 Hose1 - Server - WaterScript:38
18:03:28.331 hit - Server - WaterScript:33
18:03:28.331 Nozzle - Server - WaterScript:38
18:03:28.331 hit - Server - WaterScript:33
18:03:28.332 Nozzle - Server - WaterScript:38
18:03:28.332 hit - Server - WaterScript:33
18:03:28.332 Union - Server - WaterScript:38
18:03:28.348 hit - Server - WaterScript:33
18:03:28.348 Baseplate - Server - WaterScript:38
18:03:28.407 hit - Server - WaterScript:33
18:03:28.407 Baseplate - Server - WaterScript:38
18:03:33.760 hit - Server - WaterScript:33
18:03:33.760 Nozzle - Server - WaterScript:38
18:03:33.760 hit - Server - WaterScript:33
18:03:33.760 Nozzle - Server - WaterScript:38
18:03:33.760 hit - Server - WaterScript:33
18:03:33.760 Union - Server - WaterScript:38
18:03:33.968 hit - Server - WaterScript:33
18:03:33.968 Union - Server - WaterScript:38
18:03:33.968 hit - Server - WaterScript:33
18:03:33.968 Nozzle - Server - WaterScript:38
18:03:33.968 hit - Server - WaterScript:33
18:03:33.969 Nozzle - Server - WaterScript:38
18:03:34.068 hit - Server - WaterScript:33
18:03:34.068 Hose1 - Server - WaterScript:38
18:03:34.068 hit - Server - WaterScript:33
18:03:34.068 RightHand - Server - WaterScript:38
18:03:34.069 hit - Server - WaterScript:33
18:03:34.069 RightLowerArm - Server - WaterScript:38
18:03:34.172 hit - Server - WaterScript:33
18:03:34.172 RightUpperArm - Server - WaterScript:38
18:03:34.276 hit - Server - WaterScript:33
18:03:34.277 Hose1 - Server - WaterScript:38
18:03:34.372 hit - Server - WaterScript:33
18:03:34.372 RightLowerArm - Server - WaterScript:38
18:03:34.372 hit - Server - WaterScript:33
18:03:34.372 RightHand - Server - WaterScript:38
18:03:34.372 hit - Server - WaterScript:33
18:03:34.372 Nozzle - Server - WaterScript:38
18:03:34.373 hit - Server - WaterScript:33
18:03:34.373 Nozzle - Server - WaterScript:38
18:03:34.373 hit - Server - WaterScript:33
18:03:34.373 Union - Server - WaterScript:38
18:03:34.373 hit - Server - WaterScript:33
18:03:34.373 Handle - Server - WaterScript:38
18:03:34.373 hit - Server - WaterScript:33
18:03:34.373 RightUpperArm - Server - WaterScript:38
18:03:34.476 hit - Server - WaterScript:33
18:03:34.476 Handle - Server - WaterScript:38
18:03:34.477 hit - Server - WaterScript:33
18:03:34.477 Hose1 - Server - WaterScript:38
18:03:34.477 hit - Server - WaterScript:33
18:03:34.477 RightHand - Server - WaterScript:38
18:03:34.784 hit - Server - WaterScript:33
18:03:34.784 Hose1 - Server - WaterScript:38
18:03:34.988 hit - Server - WaterScript:33
18:03:34.988 Hose1 - Server - WaterScript:38
18:03:35.089 hit - Server - WaterScript:33
18:03:35.089 Hose1 - Server - WaterScript:38
18:03:35.285 hit - Server - WaterScript:33
18:03:35.285 Part1 - Server - WaterScript:38
18:03:35.337 hit - Server - WaterScript:33
18:03:35.337 Part1 - Server - WaterScript:38
18:03:35.385 hit - Server - WaterScript:33
18:03:35.385 Baseplate - Server - WaterScript:38
18:03:35.418 hit - Server - WaterScript:33
18:03:35.418 Baseplate - Server - WaterScript:38
18:03:36.218 hit - Server - WaterScript:33
18:03:36.218 Hose1 - Server - WaterScript:38
18:03:36.317 hit - Server - WaterScript:33
18:03:36.318 Union - Server - WaterScript:38
18:03:36.318 hit - Server - WaterScript:33
18:03:36.318 Part - Server - WaterScript:38
18:03:36.526 hit - Server - WaterScript:33
18:03:36.527 Hose1 - Server - WaterScript:38
As expected it does hit a lot of parts close to it, but everything red EXCEPT the ones that should beā¦ Iām quite boggled by it now o.O
Wish I could help out, but not actually sure now as we tried a lot :`( Not sure if someone else happens to know, or that yes, perhaps itās something very odd in Studio after all