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

how to make part follow mouse???

Asked by 3 years ago

im trying to make a magical ability like the one here

https://youtu.be/17vGaC2eoHQ?t=10

i've tried absolutely everything and it just wont work, can someone please help? i want it to be on the server for eveyrone to see, and i want it to cause damage when it hits someone. i want it to only last 5 seconds before the player is forced to let go. please help!!!

1 answer

Log in to vote
1
Answered by
rabbi99 714 Moderation Voter
3 years ago

The magical ability the video is showing is very advanced, and I am unable to explain all of it.

On the server, there's the part with a BodyPosition in it. The part's NetworkOwner is set to the player that controls it. The player has a localscript that (per RenderStep) sets the BodyPosition's position to Mouse.Hit.Position.

Localscript:

local Part = workspace.Part
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RunServ = game:GetService("RunService")

RunServ.RenderStepped:Connect(function()
    Part.BodyPosition.Position = Mouse.Hit.Position
end)

This is the way it kind of works. But then again, I'm unable to explain all of it.

0
best answer Xapelize 2658 — 3y
0
by the way if you see this, dont act smart and do Mouse.Move because if your mouse doesnt move and your character moves it doesnt work, like build a boat lol Xapelize 2658 — 3y
0
i have upvoted your answer Xapelize 2658 — 3y
Ad

Answer this question