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

Mouse.Hit.lookVector shooting objects in different locations ?

Asked by
eyad27 8
4 years ago

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 ?

0
Try Mouse.hit.P instead of mouse.hit.LookVector oilkas 364 — 4y
0
Its because, on your script line 2 the script its basically saying where the player looks face the camera up lookvector * 100 JesseSong 3916 — 4y
0
“ Try Mouse.hit.P instead of mouse.hit.LookVector” do I just write “P” or “Position” eyad27 8 — 4y
0
How do I get the mouse without referencing the player eyad27 8 — 4y
View all comments (2 more)
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 eyad27 8 — 4y
0
How do I make the question answered eyad27 8 — 4y

1 answer

Log in to vote
0
Answered by
eyad27 8
4 years ago

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

Ad

Answer this question