Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can anyone help me with my RPG-7, I need the missile to point where the mouse Is (?)

Asked by 2 years ago

As the title says, I am trying to make the RPG-7 missile to follow where the mouse Is, the problem Is that the missile always goes down

Script:

local tool = script.Parent

tool.Fire.OnServerEvent:Connect(function(player,mousePos)
    local raycastParams = RaycastParams:new()
    raycastParams.FilterDescendantsInstances = {player.Character}
    raycastParams.FilterType = Enum.RaycastFilterType.Blacklist

    local raycastResault = workspace:Raycast(tool.Handle.Position,(mousePos - tool.Handle.Position)*1000,raycastParams)
    if raycastResault then
        local Position = tool.Position:Clone()
        game:GetService("Debris"):AddItem(Position,5)
        Position.Parent = game.Workspace
        Position.Orientation = mousePos
        Position.Handle:Destroy()
        Position.Anchored = true
        ----
        local HEAT = tool.HEAT:Clone()
        game:GetService("Debris"):AddItem(HEAT,5)
        HEAT.Parent = game.Workspace
        HEAT.Orientation = Position.Position
        HEAT.Handle:Destroy()
        HEAT.Anchored = true
        HEAT.Shoot.Enabled = true
        tool.HEAT.Transparency = 1
        wait(0.1)
        tool.HEAT.Transparency = 0
    end
end)

0
whats not working? TheMiniMagic_YT 27 — 2y

Answer this question