Confused on what to put next to communicate with remote event

Hello! I am a new scripter and am trying to make a gun script below.
My goal is that when the player clicks MouseButton1 it will fire their gun, while starting on the client script I got up to line 8 but couldn’t find a tutorial that talks about what to put in the parenthesis.

I found one that uses “fireEvent:FireServer(gun.Handle.Position, mouse.Hit.p)” but I don’t want to use mouse as it is outdated. Can anyone help me?

local gun = script.Parent
local UIS = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fireEvent = ReplicatedStorage:WaitForChild("Fire")

local function onInputBegan(input, gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		fireEvent:FireServer()
	end
end

Any help is appreciated!

Couldn’t you use the UserInputService’s GetMouseLocation() instead?

That’s not outdated, you can still very much use it but you need to first make sure you understand the basics of remote events otherwise you will be making alot of mistakes: Custom Events and Callbacks | Documentation - Roblox Creator Hub

Generally the wiki is really helpful, I’d recommend you use it to read more about the APIs and they have alot of useful tutorials on some frequently asked topics.

I don’t think so as I still don’t know how to relay that info to the remote event

I think you could refer to this then perhaps?

After reading it I believe this should work, no?

local gun = script.Parent
local UIS = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fireEvent = ReplicatedStorage:WaitForChild("Fire")

mouseLocation = UIS:GetMouseLocation()
local function onInputBegan(input, gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		fireEvent:FireServer(gun.Handle.Position, mouseLocation)
	end
end

Well, mouseLocation is a Vector2 type of form & Mouse.Hit.P is a CFrame? Idk, you’d need to configure around a bit I guess

ugh its still not working after I changed it and I can’t figure out how to fix it

Mouse.Hit.p does not return a CFrame, instead a vector3. Mouse.Hit returns a cframe. You still have to use Mouse over UserInputService because UIS does not support the equivalent of Mouse.Hit or Mouse.Target.