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

How do i make it so that this fires to my mouse.hit position?

Asked by 5 years ago

SCRIPT game.ReplicatedStorage.Remotes.CrystalPowerMoves.OnServerEvent:Connect(function(playear,input) part = Instance.new("Part", workspace) part.Shape = "Ball" part.Size = Vector3.new(1,1,1) part.Material = "SmoothPlastic" part.BrickColor = BrickColor.new("White") bv = Instance.new("BodyVelocity",part) bv.MaxForce = Vector3.new(100,100,100) bv.Velocity = Vector3.new(100,100,100) Chr = playear.Character Root = Chr.RightHand part.Position = Root.Position part.CanCollide = false part.Position = input end)

LOCAL SCRIPT Plr = game.Players.LocalPlayer Mouse = Plr:GetMouse() game:GetService("UserInputService").InputBegan:Connect(function(input,Games) if input.KeyCode == Enum.KeyCode.M then game.ReplicatedStorage.Remotes.CrystalPowerMoves:FireServer(Mouse.Hit) end end)

1 answer

Log in to vote
0
Answered by
RayCurse 1518 Moderation Voter
5 years ago
Edited 5 years ago

The problem is here that on the server you're doing part.Position = input when input is a CFrame and not a Vector3. input is a CFrame because it's the result of Mouse.Hit which is a CFrame. You can fix this by changing the line to part.Position = input.Position which will set the position of the part to the positional property of the cframe.

0
cframe.p is deprecated, use cframe.Position instead theking48989987 2147 — 5y
0
I did Mouse.hit is that better or is yours better User#22788 5 — 5y
Ad

Answer this question