You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want a rocket launcher that if the rocket touches something, and that something is a part it will get un-anchored
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked on some discord servers for ROBLOX devs.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Here is the script:
local Tool = script.Parent
local Rocket = game.ReplicatedStorage.Part
local Event = game.ReplicatedStorage.RemoteEvent
local Destroyed = false
Event.OnServerEvent:Connect(function(Player, direction)
local RocketClone = Rocket:Clone()
RocketClone.Parent = game.Workspace
RocketClone.CFrame = Tool.Handle.CFrame
RocketClone.Touched:Connect(function(hit)
hit.Anchored = false
end)
local BV = Instance.new("BodyVelocity", RocketClone)
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BV.Velocity = direction.lookVector * 30
RocketClone.Touched:Connect(function(hit)
if hit ~= Tool.Handle and not Tool.Parent:FindFirstChild(hit.Name) then
hit.Anchored = false
local Explosion = Instance.new("Explosion")
Explosion.Parent = workspace
Explosion.Position = RocketClone.Position
RocketClone:Destroy()
end
end)
end)
local BV = Instance.new(“BodyVelocity”, RocketClone)
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BV.Velocity = direction.lookVector * 30
RocketClone.Touched:Connect(function(hit)
if hit ~= Tool.Handle and not Tool.Parent:FindFirstChild(hit.Name) then
hit.Anchored = false
wait(mouseHit - script.Parent.Handle.Position).Magnitude / 150)
local Explosion = Instance.new("Explosion")
Explosion.Parent = workspace
Explosion.Position = RocketClone.Position
RocketClone:Destroy()
end
end)
end)
And also, in your local script, send 2 arguments: Direction and mouse.Hit.p
To much math for my brain, to much math of that kind I am bad at. Well thank you anyways. I was hoping for a bit less complicated way. I will mark this as the solution and just try to get all that information in my head.