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)
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.
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.
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)
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.
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.