Hi dev’s! I just wanted make rocket launcher but after copying from this video: (2) Program a rocket launcher on roblox (3 EASY STEPS) - YouTube
I have problem, rocket not lauching and exploded:
Server script:
local p = script.Parent
local h = p.Handle
local fe = p.Fire
local rs1 = 25
local rpv = h.Rocket
fe.OnServerEvent:Connect(function(plr,aim)
local rp = game.ServerStorage.RocketPart:Clone()
rp.Parent = workspace
rp.CFrame = CFrame.new(h.RocketAttachment.Position,aim.Position)
rp.CanCollide = false
rp.Velocity = rp.CFrame.LookVector * rs1
local bf = Instance.new("BodyForce")
bf.Parent = rp
bf.Force = Vector3.yAxis * workspace.Gravity * rp.Mass
rp.Touched:Connect(function(hit)
if not hit:IsDescendantOf(plr.Character) then
local e = Instance.new("Explosion")
e.Parent = workspace
e.Position = rp.Position
rp:Destroy()
end
end)
end)
Local script:
local p = script.Parent
local fe = p.Fire
local lp = game.Players.LocalPlayer
local m = lp:GetMouse()
local rs = 1
local db = true
p.Activated:Connect(function()
if db then
db = false
fe:FireServer(m.Hit)
wait(rs)
db = true
end
end)
Have a nice day!