Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do get the playermouse with FE?

Asked by 7 years ago
Edited 7 years ago

how would i make a Part fire towards the mouse with FE on?

 local bv = Instance.new("BodyVelocity", CylinderMesh.Parent)
      bv.velocity = CFrame.new(CylinderMesh.Parent.Position, Mouse.Hit.p).lookVector*85
      bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)

This is in a remote event in a server script

Mouse is defined in a local script that fires the remote event containing this code while passing Mouse which is a variable for Mouse = Player:GetMouse()

that only works in Studio because for some reason in online the Mouse is nil.

I already tried to pass Mouse as Mousey = Player:GetMouse() Mouse = Mousey.Hit and changed the code to

 local bv = Instance.new("BodyVelocity", CylinderMesh.Parent)
      bv.velocity = CFrame.new(CylinderMesh.Parent.Position, Mouse.p).lookVector*85
      bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)

but When I change it to this it doesnt work properly in both studio and online. Halp plz

1 answer

Log in to vote
0
Answered by
dionant 23
7 years ago

Hello there! You must put a LocalScript on the Player's character in workspace, with a tool, on the player's script (Starterplayer > scripts) or in a GUI in the player's PlayerGui, then do this:

local Player = Game.Players.LocalPlayer --Defines the Player, LocalScripts can call for a LocalPlayer (the player who 'holds' the LS.
local Mouse = Player:GetMouse() --Sets the 'Mouse' variable to the LocalPlayer's mouse.

Further reading/references

http://wiki.roblox.com/index.php?title=API:Class/Player/GetMouse

http://wiki.roblox.com/index.php?title=API:Class/Mouse

It works, I assure.

0
1. Did you even read the question? , 2. I've already figured it out User#13357 0 — 7y
Ad

Answer this question