Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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


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

✓ Accepted answer

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.

2 comments

0

cframe.p is deprecated, use cframe.Position instead

0

I did Mouse.hit is that better or is yours better

This discussion is preserved as it was. New answers, comments, and votes are closed.