[Tower Defense]-Tower Placement Issue

So the issue is, when I place a tower, the tower just lag and move behind a little bit. I want to fix this issue. How can I fix it?

Video: Video Link

Scripts:
Module Script Function:

function towers.Spawn(player, name, defaultLevel, cframe)
	local newTower = Towers:FindFirstChild(name):FindFirstChild(defaultLevel):Clone()
	newTower:PivotTo(cframe)
	newTower.Parent = workspace.Towers
end
placeTowerFunctions.OnServerInvoke = towers.Spawn

Local Script:

UserInputService.InputBegan:Connect(function(input, processed)
	if processed then
		return
	end

	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		if IS_VIEWING_TOWER_PLACEMENT then
			placeTowerFunction:InvokeServer(TOWER_TO_SPAWN:GetAttribute("Tower"), DEFAULT_LEVEL,TOWER_TO_SPAWN.PrimaryPart.CFrame)
			IS_VIEWING_TOWER_PLACEMENT = false
		end
    end

Explorer:
image


Thank you

I believe your tower is a Model and when you’re sending a message to the server to spawn the Scout, you’re sending PrimaryPart’s CFrame, but server is positioning the whole model. Try using TOWER_TO_SPAWN:GetPivot(), this might do the magic.

1 Like

Do I use that in the parameter at the client script when fire the remote function?
Cuz it still not work.

Oh I just found out what is the problem! It is the PhysicsService. I didn’t set it on the server side but I set it on the client side only.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.