[Help!] How to make this smoke bomb disappear when thrown (And other questions)

Hello, I am adama88766. I recently made a topic about my smoke bomb, but it was a different question. (Thanks @CraftedBinary for solving it!)

I have a few questions here,
(Please guide me through on how to do it, I don’t want people making scripts for me, I really want to learn)

  1. First thing I want to achieve is that, the smoke bomb, when you press backspace, the canister disappears, but the smoke is still there for 60 seconds. When the canister disappears, I don’t want it to be picked back up again, basically used.

  2. Second I don’t want to have to press backspace to drop the smoke bomb, so I want the smoke bomb to be dropped when and where you click, but in a radius.

  3. Third, I don’t know why in studio it looks like this:
    https://i.imgur.com/8J7qdRr.png,
    and in game test mode it looks like this:
    https://i.imgur.com/5VwiciJ.png.
    I want it to look like the first one.

My script so far:

local Click = script.Parent.ClickDetector

Click.MouseClick:Connect(function()
	script.Parent.Handle.Fire.Enabled = true
	wait(2)
	script.Parent.Handle.Smoke.Enabled = true
	script.Parent.Handle.Fire.Enabled = false
	wait(60)
	script.Parent.Handle.Smoke.Enabled = false
	
	end)

All in all, I dont want it to be too complicated, just simple scripts I can understand, (I am a newbie scripter).

Thanks in advance!

1 Like

try this:

ObjectValue:Destroy()
2 Likes

Where should I put it in the script? I am a newbie scripter, still learning the basics and whatnot.

I am also new but maybe use an if command with keypressed then do object value:Destroy()

1 Like

I need an example, I can’t really originate code at the moment.

You will have to use UserInputService to know when backspace was pressed by the player. Then you will also have to determine when the left click is done with the same function but different Enum. I’ll create for you a completely example of how your source code should look like. Here is an example:

local InputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer 
local Mouse = Player:GetMouse()
local Timer = 0

local function Timer()
    Timer = Timer + 1
    wait(1)
end

InputService.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Backspace then
        game:GetService("Workspace"):FindFirstChild("Canister"):Destroy() -- Change this to your location
        Timer()
        while true do
             if Timer >= 60 then
                  game:GetService("Workspace"):FindFirstChild("SmokeSparkles"):Destroy() -- Change this to your location
                  Timer = 0
                  break
             end
         wait(0.1)
        end
    end
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        local CloneSmoke = game:GetService("ReplicatedStorage"):FindFirstChild("Smoke"):Clone() --Change this to your smoke storage room
        CloneSmoke.Position = Vector3.new(Mouse.Hit.p)
        CloneSmoke.Parent = workspace
    end
end)

Locations are something I actually am learning right now. I can show you my workspace, can you guide me on how to call a location?

@ArticGamerTV

Well, I can teach you here because we would make too much traffic on the forum. Anyway, I already made you around 95% of the script all you will have to do is logically think what is going to happen next in the script. You will probably understand everything if you carefully read the source code. I believe in you but if you are going to have problems feel free to DM here on dev forum. :slight_smile:

Okay, thanks. I also want to make this a model, so.

For model is going to work anyway but you will have to think logically how the model is going to impact on the different users of the roblox and where users will have to parent parts of models.