Part not spawning on mouse position

These 2 scripts are meant to spawn the part on the mouse. But it isnt spawning correctly.

Server Script

script.Parent.LocalScript.Slash.OnServerEvent:Connect(function(plr,pos)
	local inst = game.Lighting.Assets.E:Clone()
	local ana = inst.Slash
	ana.Parent = workspace
	ana.Position = pos

	local tweenservice = game:GetService('TweenService')
	local goal = {}
	goal.Transparency = 1
	goal.Size = Vector3.new(15.46, 393.481, 10.296)
	local ti = TweenInfo.new(0.75)
	local yes = tweenservice:Create(ana,ti,goal)
	yes:Play()
	
end)

Local Script

local p = game.Players.LocalPlayer
local deb = false
script.Parent.Activated:Connect(function()
local mouse =  p:GetMouse()

	if deb == false then
		deb = true

		script.Slash:FireServer(mouse.Hit.p)
		wait(script.Parent.Cooldown.Value)
		deb = false
	end
end)

what exactly is happening? Could you explain what’s going wrong?

It dosent spawn in the proper position.

position as in rotation or 3d point in space

Position as in 3D point in space.

could you send a screenshot or something? like is it spawning at all?

Its spawning, but in the wrong position.

your code looks right so I dont really know whats wrong, but you should probably set the pos before parenting it.

Please provide a gif so I can pinpoint the issue.

https://i.gyazo.com/e959d80018355525b0900f48e33e137e.mp4

try using c frame instead? (Mouse.Hit) and change the server script to change the cframe instead of the position. It could also be something with your tweening.

1 Like

Make the slash anchored.
If it already is anchored, don’t use position, use CFrame.

You can see that it’s not anchored because the size is making the slash move away from it’s destined position.

1 Like

Am i that dumb? Thank you, i did’nt notice this. My bad. Thanks! :smiley:

1 Like

No problem. People make mistakes.

1 Like