Hi, I'm having trouble figuring this out. Basically it's saying 'Mouse is a nil value' when it's being classified and sent through a Remote Event. Here are some details.
In local script in StarterPack:
local Player = game.Players.LocalPlayer
local Enabled = false
repeat wait() until Player and Player.Character
local Mouse = Player:GetMouse()
Mouse.KeyDown:Connect(function(key)
key = key:lower()
if not Debounce then
Debounce = true
if key == 'r' and not Enabled then
Enabled = true
ListenToGameEvent.Darkness:InvokeServer(Enum.KeyCode.R,Mouse)
wait()
Enabled = false
end
end
end)
In server script in StarterCharacterScripts:
local function Dark_Beam(Player, Key, Mouse)
ButtonDown = true
Charge = 0
local bg = Instance.new('BodyGyro')
local bp = Instance.new('BodyPosition')
local cBG=bg:Clone()
cBG.Name='SkillGyro'
cBG.Parent=Player.Character:FindFirstChild('HumanoidRootPart')
cBG.D=100
cBG.maxTorque=Vector3.new(math.huge,math.huge,math.huge)
local cBP=bp:Clone()
cBP.Parent=Player.Character:FindFirstChild('HumanoidRootPart')
cBP.Position=Player.Character.HumanoidRootPart.Position
cBP.maxForce=Vector3.new(math.huge,math.huge,math.huge)
local Beam = script.Beam:clone()
Beam.Parent = Player.Character
Beam.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-220)*CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
while ButtonDown == true do
wait()
Charge = Charge + 1
local pos=Mouse.hit.p
end
end
The part you need to focus on is
local pos=Mouse.hit.p
It's saying Mouse is a nil value, Mouse is classified in the Local Script and is sent through the Remote Event, But it is saying Mouse is nil for some reason, I'm really confused on this and It'd be great if someone could help, thank you.

5 comments
The server can't access the mouse, whether its used in a remote event/function or not. The mouse is only local to the player.
Just send
Mouse.hit.p, not the whole mouse!Also, why are you making an unused variable in the while loop?
Oh there is more of the script in there that wasn't relevant toward my problem.
Firing Mouse.hit.p through the remote function doesn't work either, just says nil.