I won't do this for you, but I'll shoot you some ideas about going about this.
####- Suggestion 1, ####
Use a Local Script inserted into some Service that gets replicated to the player, like StarterGui.
####- Suggestion 2, ####
Now that we're using a Local Script, we can get the Local Player and the player's mouse. We would do this like so,
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
Get's player, and player's mouse
####- Suggestion 3, ####
Use user input service to detect the Z button being pressed.
####- Suggestion 4, #####
Insert an invisible part that follows the mouse, and place the particles in the part.
####- Suggestion 5, ####
Use mouse.Hit to get the CFrame of the mouse's world CFrame. This is very important. You would do the following to make a part where the mouse is in the world,
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local p = Instance.new("Part", game.Workspace)
p.CFrame = mouse.Hit
But this wouldn't really work if mouse.Hit is nil, and also because this isn't on a loop or event.
So Also,
Use a Mouse move event. Similar to so,
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.Move:connect(function()
if mouse.Hit ~= nil then
local p = Instance.new("Part", game.Workspace)
p.CFrame = mouse.Hit
end
end)
Those are some of my ideas. I would provide an complete answer if I had more time. Later, if you're still having trouble, I could provide a better answer.
Good Luck!
If I did help, please don't forget to hit the accept button, it helps a lot. Thank you.
3 comments
As an extension of the above, look at Mouse.Hit to get the position that the mouse is at, and if you insert a BodyPosition into the part and give it a maxForce of (math.huge,math.huge,math.huge), then just set the position to the Mouse.Hit value
You could use the Enabled property of the particle effect to turn it on and off.
Ah, that is something I forgot. I'm going to add that because that's very important.