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

how can I make my projectile face and move toward my mouse, without body forces(use vector3)?

Asked by
lilzy7 68
3 years ago
Edited 3 years ago

Here is my script:

Local Script:

local rp = game:GetService("ReplicatedStorage")
local event = rp:WaitForChild("RemoteEvent")
local player = game:GetService("Players").LocalPlayer
local Mouse = player:GetMouse()
local debounce = false

Mouse.Move:Connect(function()

if debounce == false then
debounce = true
local MousePosition = Mouse.Hit

event:FireServer(MousePosition)
end

end)

Server Script:

local rp = game:GetService("ReplicatedStorage")

local event = rp:WaitForChild("RemoteEvent")

event.OnServerEvent:Connect(function(player,mp)
    local projectile = player.Character:FindFirstChild("projectile")
-- how do i make the projectile go the direction where my mouse was and move that direction?
-- also, i placed projectile in body in earlier script.
end)

EXTRA: also, another question I have is how can I make a projectile go outwards of my humanoid root part, or body part? (outward direction of body, and based on its rotation, not just always going left or something, it changes direction based on body rotation, forward of it).

0
The Mouse Has A Position where the player has clicked. You can Get it with "Mouse.hit.p" . You can send mouse hit .p to the server . You Can Make Something look at something Like This `CFrame.new(Part.CFrame , mousehit.p`)` Tizzel40 243 — 3y
0
how can i make it look at something and move that direction? lilzy7 68 — 3y
0
hello? lilzy7 68 — 3y

Answer this question