I have this punching script and and for some reason it says "mouse(a nil value)" here is the script
local Humanoid = player.Character.Humanoid local debounce = false local mouse = player:GetMouse() mouse.KeyDown:connect(function(key) if key == "q" then if not debounce then debounce = true ------------------------------------------------------------------------ --Animation for Punch local Punch = Instance.new("Animation") Punch.AnimationId = "http://www.roblox.com/Asset?ID=644505212" local animTrack = Humanoid:LoadAnimation(Punch) animTrack:Play(0,2,2.5) ------------------------------------------------------------------------------- --Lighting for Punch local lightning = replicatedstorage.RicoClass:WaitForChild("Lightning") local light = lightning:clone() light.Parent = game.Workspace light.Anchored = false light.CanCollide = false local w = Instance.new("Weld" ,light) w.Part0 = player.Character.RTIndexFinger w.Part1 = light w.C1 = CFrame.Angles(0,0,40) w.C0 = CFrame.new(0,0,0.2) light.Touched:connect(function(part) if not db then db = true local h = part.Parent:findFirstChild("Humanoid") if h ~= nil then h.Health = h.Health - 10 wait(0.3) db = false end end end) wait(0.3) light:Destroy() ------------------------------------------------------------------------------- wait(0.3) debounce = false end end end)
You cant. The server doesnt have a mouse. To acces mouse properties in the server you'll have to send each property over using remoteEvents fromout the client. (Or remoteFunctions)
Localscript:
Event:FireServer(mouse.Target,mouse.Hit)
Serverscript:
Event.OnServerEvent:Connect(function(player,target,hit) --do stuff end)