local Throw = script.Parent:WaitForChild("Throw")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SmokeGrenade = ReplicatedStorage:WaitForChild("SmokeGrenade")
Throw.OnServerEvent:Connect(function(player, Pos)
local Char = player.Character or player.CharacterAdded:Wait()
local HRP = Char:FindFirstChild("HumanoidRootPart")
if HRP then
local Cloned_SmokeGrenade = SmokeGrenade:Clone()
Cloned_SmokeGrenade.Parent = game.Workspace
Cloned_SmokeGrenade.CFrame = CFrame.new(HRP.Position + Vector3.new(0,1,3), Pos)
Cloned_SmokeGrenade.Velocity = Cloned_SmokeGrenade.LookVector * 100 --Multiply this by how fast you want the grenade to travel
wait(1)
Cloned_SmokeGrenade.Touched:Connect(function()
local TempPart = Instance.new("Part")
TempPart.Parent = game.Workspace
local Smoke = Instance.new("Smoke")
Smoke.Parent = TempPart
Smoke.Color = Color3.fromRGB(213,213,213)
Smoke.Size = 45
wait(12)
TempPart:Destroy()
end)
Cloned_SmokeGrenade:Destroy()
end
end)
To get a direction you can do local direction = (Position1 - Position2).Unit
That will give you a direction from position2 to position1
Second speed which is pretty easy local speed = 5--Any number will do
Then to get velocity local velocity = speed * direction
If you want the grenade to go up a bit simply add it on to the equation local velocity = (speed * direction) + Vector3.new(0,10,0)--Depending on how high you want it
Of course use AssemblyLInearVelocity instead of Velocity bc it is depracated
What difference would it make? I know it sets the value as 1 or something, but I’m not sure what purpose you’d use it on
local Throw = script.Parent:WaitForChild("Throw")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SmokeGrenade = ReplicatedStorage:WaitForChild("SmokeGrenade")
Throw.OnServerEvent:Connect(function(player, Pos)
local Char = player.Character or player.CharacterAdded:Wait()
local HRP = Char:FindFirstChild("HumanoidRootPart")
if HRP then
local Cloned_SmokeGrenade = SmokeGrenade:Clone()
Cloned_SmokeGrenade.Parent = game.Workspace
Cloned_SmokeGrenade.CFrame = CFrame.new(HRP.Position + Vector3.new(0,1,3), Pos)
Cloned_SmokeGrenade.Velocity = Cloned_SmokeGrenade.LookVector.Unit * 100 --Multiply this by how fast you want the grenade to travel
wait(1)
Cloned_SmokeGrenade.Touched:Connect(function()
local TempPart = Instance.new("Part")
TempPart.Parent = game.Workspace
local Smoke = Instance.new("Smoke")
Smoke.Parent = TempPart
Smoke.Color = Color3.fromRGB(213,213,213)
Smoke.Size = 45
wait(12)
TempPart:Destroy()
end)
Cloned_SmokeGrenade:Destroy()
end
end)
You need it to make sure that the sped stays the same. It is complicated and you can look it up, just please use it. Without it it could be vulnerable to unwanted problems with speed and exploiters changing bullet speed.
local Throw = script.Parent:WaitForChild("Throw")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SmokeGrenade = ReplicatedStorage:WaitForChild("SmokeGrenade")
Throw.OnServerEvent:Connect(function(player, Pos)
local Char = player.Character or player.CharacterAdded:Wait()
local HRP = Char:FindFirstChild("HumanoidRootPart")
if HRP then
local Cloned_SmokeGrenade = SmokeGrenade:Clone()
Cloned_SmokeGrenade.Parent = game.Workspace
Cloned_SmokeGrenade.CFrame = CFrame.new(HRP.Position + Vector3.new(0,1,3), Pos)
Cloned_SmokeGrenade.Velocity = Cloned_SmokeGrenade.CFrame.LookVector.Unit * 100 --Multiply this by how fast you want the grenade to travel
wait(1)
Cloned_SmokeGrenade.Touched:Connect(function()
local TempPart = Instance.new("Part")
TempPart.Parent = game.Workspace
local Smoke = Instance.new("Smoke")
Smoke.Parent = TempPart
Smoke.Color = Color3.fromRGB(213,213,213)
Smoke.Size = 45
wait(12)
TempPart:Destroy()
end)
Cloned_SmokeGrenade:Destroy()
end
end)