I made a model and I have no idea on how to fire it, I want it to go to where my cursor is but I cant seem to do it. Help!
code just in case you need it:
local HookProjectile = HookModel:Clone()
HookProjectile.Parent = workspace
HookProjectile.CanCollide = false
HookProjectile.CFrame = HumRP.CFrame * CFrame.new(0,0,0)
HookProjectile.CFrame = CFrame.new(HookProjectile.Position,MouseHit.p)
HookProjectile.Touched:Connect(function(Hit)
local db = false
if Hit.Name == "Union" then
if not db then
db = true
HookTouched(Player,HookProjectile,HookModel,AmountOfHooks)
end
HookProjectile:Destroy()
db = true
end
end)
game.Debris:AddTag(HookProjectile,2.5)
delay(2.2,function()
local Tween = TS:Create(HookProjectile,TweenInfo.new(0.3),{Transparency = 1})
Tween:Play()
if AmountOfHooks.Value <= 0 then
end
end)
And the function I call in the script above.
function HookTouched(Player, Projectile, Model, AmountOfHooks)
local HookPostition = Projectile.Position
local NewHook = Model:Clone()
NewHook.Parent = workspace
NewHook.Position = HookPostition
NewHook.Anchored = true
NewHook.Rotation = Projectile.Rotation
NewHook.Name = "HookUsed"
local Rope2 = Instance.new("RopeConstraint")
Rope2.Attachment0 = NewHook.Attachment1
Rope2.Attachment1 = Player.Character:FindFirstChild("Torso").BodyFrontAttachment
Rope2.Thickness = .2
Rope2.Visible = true
Rope2.Length = (NewHook.Position - Player.Character.HumanoidRootPart.Position).magnitude - 1
Rope2.Parent = NewHook
AmountOfHooks.Value = AmountOfHooks.Value + 1
end
People have told me to use vector force, but I dont know how to do that, and other topics say linear velocity and I dont know what that is either. What is the best way to do this?