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).

3 comments

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)`

0

how can i make it look at something and move that direction?

0

hello?