This is the script:

wait()

script.Parent.OnServerEvent:Connect(function(player)
	
	local character = player.Character
	local melee = player.PlayerStats.Melee.Value
	
	if character.HumanoidRootPart:FindFirstChild("BodyVelocity") ~= nil then
	character.HumanoidRootPart.BodyVelocity:Destroy()
	end
	
	local bdv = Instance.new("BodyVelocity",character.HumanoidRootPart)
	bdv.Name = "bdv"
	bdv.Velocity = Vector3.new(0,-90,0) * (melee/30 + 5)
	bdv.MaxForce = Vector3.new(99999,99999,99999)
	
	local td = game.ReplicatedStorage.Objects.TouchDetector2:Clone()
	td.Parent = character.HumanoidRootPart
		td.CFrame = character.HumanoidRootPart.CFrame
	
	local weld = Instance.new("Weld",td)
	weld.Part0 = td
	weld.Part1 = character.HumanoidRootPart
	
	td.Touched:Connect(function(hit)
		
		if hit.Anchored == true then
			
			

			
			character.HumanoidRootPart.Anchored = true
			
			td:Destroy()
			
			local cfr = character.LowerTorso.CFrame
			
			
			local cr = game.ReplicatedStorage.Objects["Cracks and rocks"]:Clone()
			wait()
			cr.Parent = character.LowerTorso
			cr.Size = Vector3.new((melee/5)+10,(melee/5)+10,(melee/5)+10)
			cr.CFrame = cfr
		
			
			
			
			
			wait(1)
			
			bdv.Velocity = Vector3.new(0,90,0)
	bdv:Destroy()
		character.HumanoidRootPart.Anchored = false
		
	
			
		end
		
		
		
		
		
	end)
	
	
end)

So the character is falling down faster than normal cause there's a body velocity making it go down. Now that part's CFrame should be the same as the HumanoidRootPart.CFrame as it hits the ground, but instead the CFrame of the part is well above the character. Any ideas how to fix that?

2 comments

1

you should try to send the humanoidrootparts position from the client to the server with a remote event because in the server the player may have not landed yet

0

So do i call the client, and then the server again or?