So basically I am making a script where, if you press C, you fly and your character flies to where your mouse is aiming for 3 seconds. But I don't know how to make so the server has constantly access to the mouse Position. Here's my local script
if input.KeyCode == Enum.KeyCode.C then if not flightEnabled then return end handler:FireServer({"Fire", "Flight"}) local cd = Instance.new("IntValue", player.Character) cd.Name = "FlightCooldown" cd.Value = 14 cooldownGui.Flight.FlightFrame.BackgroundTransparency = 0.3 for i=1, 13 do cd.Value = cd.Value - 1 cooldownGui.Flight.FlightText.Text = cd.Value wait(1) end cooldownGui.Flight.FlightText.Text = "C" cooldownGui.Flight.FlightFrame.BackgroundTransparency = 1 cd:Remove() flightEnabled = true end end)
There's a way to get the mouse's CFrame in the game, using mouse.Origin. Wiki link: https://wiki.roblox.com/index.php?title=API:Class/Mouse/Origin
You will get the player's mouse position by doing this:
local Player = game:GetService("Players").LocalPlayer local Mouse = Player:GetMouse() then you will want to update the mouse whenever it's moved Mouse.Move:Connect(function() local mousePosition = Mouse.Hit.p --- send the mousePosition to the server using remote events end)