Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Mouse.Hit.lookVector shooting objects in different locations ?

For some reason, the blast doesn't follow the position of the mouse. It goes in diffrent locations based on the player's rotation.

RC.OnServerInvoke = function(player,empty,hum,car,pli,play,mouse)
    hum.WalkSpeed = 0
    wait()
    empty = false
    local block = Instance.new("Animation")
    block.AnimationId = blockid
    local BlockTrack = hum:LoadAnimation(block)
    BlockTrack:Play()
    wait(0.5)
    local blast = Instance.new("Part")
    blast.Parent = game.Workspace
    blast.CanCollide = false
    blast.BrickColor = BrickColor.new("White")
    blast.Material = Enum.Material.Neon
    blast.Size = Vector3.new(4,4,30)
    blast.CFrame = car.HumanoidRootPart.CFrame * CFrame.new(0,0,5)
    local body = Instance.new("BodyForce")
    body.Force =  play
    body.Parent = blast
    wait(1)
    block:Destroy()
    hum.WalkSpeed = 16
    empty = true
end

```local mouse = pli:GetMouse()
local play = mouse.Hit.lookVector * 100```

Evidence:

https://streamable.com/5gzr4r

Any suggestions/ solutions ?

6 comments

0

Try Mouse.hit.P instead of mouse.hit.LookVector

0

Its because, on your script line 2 the script its basically saying where the player looks face the camera up lookvector * 100

0

“ Try Mouse.hit.P instead of mouse.hit.LookVector” do I just write “P” or “Position”

0

How do I get the mouse without referencing the player

0

I finally managed to solve it by adding the mouse.Hit feature inside the InputBegan function and it worked. Thanks to everyone that helped

0

How do I make the question answered

1 answer

I finally managed to solve it by adding the mouse.Hit feature inside the InputBegan function and it worked. Thanks to everyone that helped.

This discussion is preserved as it was. New answers, comments, and votes are closed.