This is the server script, and recently i have found that the mouse cannot be gotten inside of it, is there a way to transfer an already defined mouse from a local to the server script?

Here's my script:

wait()
local event = script.Parent



event.OnServerEvent:Connect(function(player)


    local anim = player.Character.Humanoid:LoadAnimation(script.Charge)

    anim:Play()

local darknebula = Instance.new("Part")
darknebula.Shape = "Ball"
darknebula.Parent = player.Character.RightHand
darknebula.Size = Vector3.new(35, 35, 35)
darknebula.Color = Color3.fromRGB(0, 0, 0)
darknebula.Material = "Neon"
darknebula.Name = "darknebula"
darknebula.Massless = true

local weld = Instance.new("Weld")
weld.Name = "Weld"
weld.Parent = darknebula
weld.Part1 = darknebula
weld.Part0 = player.Character.RightHand
weld.C0 = CFrame.new(0, 0, 0)
weld.C1 = CFrame.new(0, 35, 0)



local bg = Instance.new("BodyGyro",player.Character.UpperTorso)
bg.Name = "skillgyro"
bg.D = 100
bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

local bp = Instance.new("BodyPosition",player.Character.UpperTorso)
bp.Name = "skillposition"
bp.Position = player.Character.HumanoidRootPart.Position
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

local mouse = player:GetMouse()
local Pos = mouse.CFrame
bg.CFrame = CFrame.new(player.Character.UpperTorso.Position,Pos)

4 comments

0

No mouse is client side only, there is no way to transfer it to the server, nor would you want to. You can only transfer properties of it such as Hit, or Icon. The only way to communicate with it would be the normal FE methods like Remote Events/Functions

0

I need to transfer the hit property, how exactly can i do it?

0

Send the hit and not the mouse instance itself

0

I don't completely know how to do that could you maybe tell me or send me the dev wiki thread?